getD3dSparse | R Documentation |

getD3dSparse is a function that helps to construct generalized lasso
penalty matrix D when using the `fusedlasso`

function over a 3 dimensional grid

getD3dSparse(dim1, dim2, dim3)

`dim1` |
positive integer. Based on a 3 dimensional grid, dim1 represents the number of units represented on the first dimension |

`dim2` |
positive integer which represents the number of units represented on the second dimension |

`dim3` |
positive integer which represents the number of units represented on the third dimension |

The function returns a sparse penalty matrix providing information on the connections between the variables during the implementation of a generalizad fused lasso.

a matrix with dim1 x dim2 x dim3 columns. Each row represents an
edge (a link between 2 variables) and is constructed with the couple (-1, 1),
relative to these 2 variables and 0 for all others. In the context of a
generalized fused lasso, this matrix penalizes only the differences in
coefficients (fusion). To obtain parsimony in addition to the fusion, a
diagonal matrix with the same number of columns must be bound to the
penalty matrix constructed by getD3dSparse. This matrix will contain
diagonally the ratio: parsimony penalty parameter on fusion penalty
parameter. When using `fusedlasso`

function, this operation is performed when you provide the argument gamma.

library(genlasso) library(Matrix) D<-getD3dSparse(2,3,2) plot(getGraph(D))

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.