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.1716053

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.1658465
#> 
#> $Sigma
#> $Sigma[[1]]
#>             [,1]        [,2]     [,3]     [,4]     [,5]
#> [1,]  1.03123754 -0.03610399 0.000000 0.000000 0.000000
#> [2,] -0.03610399  0.90955491 0.000000 0.000000 0.000000
#> [3,]  0.00000000  0.00000000 1.187172 0.000000 0.000000
#> [4,]  0.00000000  0.00000000 0.000000 1.383032 0.000000
#> [5,]  0.00000000  0.00000000 0.000000 0.000000 1.168179
#> 
#> 
#> $Omega
#> $Omega[[1]]
#>            [,1]       [,2]      [,3]      [,4]      [,5]
#> [1,] 0.97105817 0.03854531 0.0000000 0.0000000 0.0000000
#> [2,] 0.03854531 1.10096886 0.0000000 0.0000000 0.0000000
#> [3,] 0.00000000 0.00000000 0.8423377 0.0000000 0.0000000
#> [4,] 0.00000000 0.00000000 0.0000000 0.7230489 0.0000000
#> [5,] 0.00000000 0.00000000 0.0000000 0.0000000 0.8560332

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.3697949 0.2480944 0.1636668
robsel.fits <- robsel.glasso(x, alphas)
robsel.fits
#> $alpha
#> [1] 0.1 0.5 0.9
#> 
#> $lambda
#> [1] 0.3639983 0.2394213 0.1727761
#> 
#> $Sigma
#> $Sigma[[1]]
#>          [,1]     [,2]     [,3]     [,4]     [,5]
#> [1,] 1.229389 0.000000 0.000000 0.000000 0.000000
#> [2,] 0.000000 1.107707 0.000000 0.000000 0.000000
#> [3,] 0.000000 0.000000 1.385324 0.000000 0.000000
#> [4,] 0.000000 0.000000 0.000000 1.581184 0.000000
#> [5,] 0.000000 0.000000 0.000000 0.000000 1.366331
#> 
#> $Sigma[[2]]
#>          [,1]      [,2]     [,3]     [,4]     [,5]
#> [1,] 1.104812 0.0000000 0.000000 0.000000 0.000000
#> [2,] 0.000000 0.9831297 0.000000 0.000000 0.000000
#> [3,] 0.000000 0.0000000 1.260747 0.000000 0.000000
#> [4,] 0.000000 0.0000000 0.000000 1.456607 0.000000
#> [5,] 0.000000 0.0000000 0.000000 0.000000 1.241754
#> 
#> $Sigma[[3]]
#>             [,1]        [,2]     [,3]     [,4]     [,5]
#> [1,]  1.03816719 -0.02917434 0.000000 0.000000 0.000000
#> [2,] -0.02917434  0.91648457 0.000000 0.000000 0.000000
#> [3,]  0.00000000  0.00000000 1.194102 0.000000 0.000000
#> [4,]  0.00000000  0.00000000 0.000000 1.389962 0.000000
#> [5,]  0.00000000  0.00000000 0.000000 0.000000 1.175109
#> 
#> 
#> $Omega
#> $Omega[[1]]
#>           [,1]     [,2]      [,3]      [,4]      [,5]
#> [1,] 0.8134119 0.000000 0.0000000 0.0000000 0.0000000
#> [2,] 0.0000000 0.902766 0.0000000 0.0000000 0.0000000
#> [3,] 0.0000000 0.000000 0.7218527 0.0000000 0.0000000
#> [4,] 0.0000000 0.000000 0.0000000 0.6324374 0.0000000
#> [5,] 0.0000000 0.000000 0.0000000 0.0000000 0.7318872
#> 
#> $Omega[[2]]
#>           [,1]    [,2]      [,3]      [,4]      [,5]
#> [1,] 0.9051311 0.00000 0.0000000 0.0000000 0.0000000
#> [2,] 0.0000000 1.01716 0.0000000 0.0000000 0.0000000
#> [3,] 0.0000000 0.00000 0.7931805 0.0000000 0.0000000
#> [4,] 0.0000000 0.00000 0.0000000 0.6865269 0.0000000
#> [5,] 0.0000000 0.00000 0.0000000 0.0000000 0.8053126
#> 
#> $Omega[[3]]
#>            [,1]       [,2]      [,3]      [,4]      [,5]
#> [1,] 0.96409843 0.03069002 0.0000000 0.0000000 0.0000000
#> [2,] 0.03069002 1.09210280 0.0000000 0.0000000 0.0000000
#> [3,] 0.00000000 0.00000000 0.8374494 0.0000000 0.0000000
#> [4,] 0.00000000 0.00000000 0.0000000 0.7194441 0.0000000
#> [5,] 0.00000000 0.00000000 0.0000000 0.0000000 0.8509852