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 \(\lambda\), a regularization parameter for Graphical Lasso at a prespecified confidence level \(\alpha\).

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

Graphical Lasso algorithm with \(\lambda\) 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.1475486
#> 
#> $Sigma
#> $Sigma[[1]]
#>           [,1]     [,2]     [,3]      [,4]     [,5]
#> [1,] 0.9985492 0.000000 0.000000 0.0000000 0.000000
#> [2,] 0.0000000 1.202963 0.000000 0.0000000 0.000000
#> [3,] 0.0000000 0.000000 1.242805 0.0000000 0.000000
#> [4,] 0.0000000 0.000000 0.000000 0.8138968 0.000000
#> [5,] 0.0000000 0.000000 0.000000 0.0000000 1.341003
#> 
#> 
#> $Omega
#> $Omega[[1]]
#>          [,1]     [,2]      [,3]     [,4]      [,5]
#> [1,] 1.001453 0.000000 0.0000000 0.000000 0.0000000
#> [2,] 0.000000 0.831281 0.0000000 0.000000 0.0000000
#> [3,] 0.000000 0.000000 0.8046314 0.000000 0.0000000
#> [4,] 0.000000 0.000000 0.0000000 1.228657 0.0000000
#> [5,] 0.000000 0.000000 0.0000000 0.000000 0.7457102

Use RobSel with multiple prespecified confidence levels

We can use multiple \(\alpha\) simultaneously with Robust Selection

alphas <- c(0.1, 0.5, 0.9)
lambdas <- robsel(x, alphas)
lambdas
#> [1] 0.2780142 0.2088496 0.1438205
robsel.fits <- robsel.glasso(x, alphas)
robsel.fits
#> $alpha
#> [1] 0.1 0.5 0.9
#> 
#> $lambda
#> [1] 0.3002651 0.2058031 0.1428775
#> 
#> $Sigma
#> $Sigma[[1]]
#>          [,1]     [,2]     [,3]      [,4]    [,5]
#> [1,] 1.151266 0.000000 0.000000 0.0000000 0.00000
#> [2,] 0.000000 1.355679 0.000000 0.0000000 0.00000
#> [3,] 0.000000 0.000000 1.395522 0.0000000 0.00000
#> [4,] 0.000000 0.000000 0.000000 0.9666134 0.00000
#> [5,] 0.000000 0.000000 0.000000 0.0000000 1.49372
#> 
#> $Sigma[[2]]
#>          [,1]     [,2]    [,3]      [,4]     [,5]
#> [1,] 1.056804 0.000000 0.00000 0.0000000 0.000000
#> [2,] 0.000000 1.261217 0.00000 0.0000000 0.000000
#> [3,] 0.000000 0.000000 1.30106 0.0000000 0.000000
#> [4,] 0.000000 0.000000 0.00000 0.8721514 0.000000
#> [5,] 0.000000 0.000000 0.00000 0.0000000 1.399258
#> 
#> $Sigma[[3]]
#>           [,1]     [,2]     [,3]      [,4]     [,5]
#> [1,] 0.9938781 0.000000 0.000000 0.0000000 0.000000
#> [2,] 0.0000000 1.198292 0.000000 0.0000000 0.000000
#> [3,] 0.0000000 0.000000 1.238134 0.0000000 0.000000
#> [4,] 0.0000000 0.000000 0.000000 0.8092257 0.000000
#> [5,] 0.0000000 0.000000 0.000000 0.0000000 1.336332
#> 
#> 
#> $Omega
#> $Omega[[1]]
#>           [,1]      [,2]      [,3]    [,4]      [,5]
#> [1,] 0.8686092 0.0000000 0.0000000 0.00000 0.0000000
#> [2,] 0.0000000 0.7376376 0.0000000 0.00000 0.0000000
#> [3,] 0.0000000 0.0000000 0.7165779 0.00000 0.0000000
#> [4,] 0.0000000 0.0000000 0.0000000 1.03454 0.0000000
#> [5,] 0.0000000 0.0000000 0.0000000 0.00000 0.6694695
#> 
#> $Omega[[2]]
#>           [,1]      [,2]      [,3]    [,4]      [,5]
#> [1,] 0.9462495 0.0000000 0.0000000 0.00000 0.0000000
#> [2,] 0.0000000 0.7928848 0.0000000 0.00000 0.0000000
#> [3,] 0.0000000 0.0000000 0.7686043 0.00000 0.0000000
#> [4,] 0.0000000 0.0000000 0.0000000 1.14659 0.0000000
#> [5,] 0.0000000 0.0000000 0.0000000 0.00000 0.7146645
#> 
#> $Omega[[3]]
#>         [,1]      [,2]     [,3]     [,4]      [,5]
#> [1,] 1.00616 0.0000000 0.000000 0.000000 0.0000000
#> [2,] 0.00000 0.8345214 0.000000 0.000000 0.0000000
#> [3,] 0.00000 0.0000000 0.807667 0.000000 0.0000000
#> [4,] 0.00000 0.0000000 0.000000 1.235749 0.0000000
#> [5,] 0.00000 0.0000000 0.000000 0.000000 0.7483168