R: Helper functions for constructing generalized lasso penalty...
getDxx
R Documentation
Helper functions for constructing generalized lasso penalty matrices
Description
These are utility functions for creating penalty matrices for the
fused lasso and trend filtering problems. Most users will not need to
explicitly construct these as they are created internally by the
fusedlasso or trendfilter functions. The sparse
variants output sparse matrices, which should be used whenever
possible because of a significant savings in both construction speed
and memory usage.
The function getGraph is an inverse function for fused lasso problems,
returning an igraph object (from the igraph package), the
graph corresponding to the passed penalty matrix.
The arguments for the sparse variants are identical to those for the
regular variants, which are described below.
n
for getD1d, getDtf, and getDtfPos,
the number of points in the 1d sequence.
dim1, dim2
for getD2d, the number of rows and columns in the 2d grid,
respectively.
graph
for getDg, an igraph object from the igraph
package, upon which the penalty matrix should be based (the penalty
matrix is the oriented incidence matrix of the graph, with arbitrary
orientations assigned to each edge).
ord
for getDtf, and getDtfPos, the order of the
polynomial. E.g., ord=0 is the 1d fused lasso and ord=1 is linear
trend filtering. Hence the returned matrix is the discrete (ord+1)st
derivative operator.
pos
for getDtfPos, a numeric vector giving the positions of
points in the 1d sequence. Must have length n.
D
for getGraph, a fused lasso penalty matrix, the incidence
matrix of an undirected graph, with arbitrary edge orientations.
Value
All functions except getGraph return a penalty matrix, either
in standard R matrix format or as a sparse matrix of class
dgCMatrix via the Matrix package. The function
getGraph returns an igraph object from the igraph
package.