Using the robsel package

This vignette illustrate the basic usage of the robsel package to estimate of the regularization parameter for Graphical Lasso.

Data

We use a 100-by-5 matrix from generate from normal distribution.

x <- matrix(rnorm(100*5),ncol=5)

Using robsel functions

Estimate of the regularization parameter for Graphical Lasso

The function robsel estimates λ, a regularization parameter for Graphical Lasso at a prespecified confidence level α.

library(robsel)
lambda <- robsel(x)
lambda
#> [1] 0.1761719

Graphical Lasso algorithm with λ from Robust Selection

The function robsel.glasso returns estimates a sparse inverse covariance matrix using Graphical Lasso with regularization parameter estimated from Robust Selection

A <- robsel.glasso(x)
A
#> $alpha
#> [1] 0.9
#> 
#> $lambda
#> [1] 0.1702785
#> 
#> $Sigma
#> $Sigma[[1]]
#>          [,1]          [,2]     [,3]     [,4]          [,5]
#> [1,] 1.260527  0.0000000000 0.000000 0.000000  0.0000000000
#> [2,] 0.000000  1.0200097551 0.000000 0.000000 -0.0009702073
#> [3,] 0.000000  0.0000000000 1.276171 0.000000  0.0000000000
#> [4,] 0.000000  0.0000000000 0.000000 1.295469  0.0000000000
#> [5,] 0.000000 -0.0009702073 0.000000 0.000000  1.1981454320
#> 
#> 
#> $Omega
#> $Omega[[1]]
#>           [,1]        [,2]      [,3]      [,4]        [,5]
#> [1,] 0.7933189 0.000000000 0.0000000 0.0000000 0.000000000
#> [2,] 0.0000000 0.980383536 0.0000000 0.0000000 0.000793873
#> [3,] 0.0000000 0.000000000 0.7835942 0.0000000 0.000000000
#> [4,] 0.0000000 0.000000000 0.0000000 0.7719215 0.000000000
#> [5,] 0.0000000 0.000793873 0.0000000 0.0000000 0.834623864

Use RobSel with multiple prespecified confidence levels

We can use multiple α simultaneously with Robust Selection

alphas <- c(0.1, 0.5, 0.9)
lambdas <- robsel(x, alphas)
lambdas
#> [1] 0.3595559 0.2436547 0.1666169
robsel.fits <- robsel.glasso(x, alphas)
robsel.fits
#> $alpha
#> [1] 0.1 0.5 0.9
#> 
#> $lambda
#> [1] 0.3457261 0.2534988 0.1695112
#> 
#> $Sigma
#> $Sigma[[1]]
#>          [,1]     [,2]     [,3]     [,4]     [,5]
#> [1,] 1.435975 0.000000 0.000000 0.000000 0.000000
#> [2,] 0.000000 1.195457 0.000000 0.000000 0.000000
#> [3,] 0.000000 0.000000 1.451618 0.000000 0.000000
#> [4,] 0.000000 0.000000 0.000000 1.470916 0.000000
#> [5,] 0.000000 0.000000 0.000000 0.000000 1.373593
#> 
#> $Sigma[[2]]
#>          [,1]    [,2]     [,3]     [,4]     [,5]
#> [1,] 1.343748 0.00000 0.000000 0.000000 0.000000
#> [2,] 0.000000 1.10323 0.000000 0.000000 0.000000
#> [3,] 0.000000 0.00000 1.359391 0.000000 0.000000
#> [4,] 0.000000 0.00000 0.000000 1.378689 0.000000
#> [5,] 0.000000 0.00000 0.000000 0.000000 1.281366
#> 
#> $Sigma[[3]]
#>         [,1]         [,2]     [,3]     [,4]         [,5]
#> [1,] 1.25976  0.000000000 0.000000 0.000000  0.000000000
#> [2,] 0.00000  1.019242495 0.000000 0.000000 -0.001737467
#> [3,] 0.00000  0.000000000 1.275404 0.000000  0.000000000
#> [4,] 0.00000  0.000000000 0.000000 1.294701  0.000000000
#> [5,] 0.00000 -0.001737467 0.000000 0.000000  1.197378172
#> 
#> 
#> $Omega
#> $Omega[[1]]
#>          [,1]      [,2]      [,3]      [,4]      [,5]
#> [1,] 0.696391 0.0000000 0.0000000 0.0000000 0.0000000
#> [2,] 0.000000 0.8364999 0.0000000 0.0000000 0.0000000
#> [3,] 0.000000 0.0000000 0.6888863 0.0000000 0.0000000
#> [4,] 0.000000 0.0000000 0.0000000 0.6798484 0.0000000
#> [5,] 0.000000 0.0000000 0.0000000 0.0000000 0.7280176
#> 
#> $Omega[[2]]
#>           [,1]      [,2]      [,3]      [,4]      [,5]
#> [1,] 0.7441874 0.0000000 0.0000000 0.0000000 0.0000000
#> [2,] 0.0000000 0.9064292 0.0000000 0.0000000 0.0000000
#> [3,] 0.0000000 0.0000000 0.7356234 0.0000000 0.0000000
#> [4,] 0.0000000 0.0000000 0.0000000 0.7253268 0.0000000
#> [5,] 0.0000000 0.0000000 0.0000000 0.0000000 0.7804173
#> 
#> $Omega[[3]]
#>           [,1]        [,2]      [,3]      [,4]        [,5]
#> [1,] 0.7938021 0.000000000 0.0000000 0.0000000 0.000000000
#> [2,] 0.0000000 0.981123215 0.0000000 0.0000000 0.001423668
#> [3,] 0.0000000 0.000000000 0.7840656 0.0000000 0.000000000
#> [4,] 0.0000000 0.000000000 0.0000000 0.7723789 0.000000000
#> [5,] 0.0000000 0.001423668 0.0000000 0.0000000 0.835160100