PreEst.glasso: Precision Matrix Estimation via Graphical Lasso

Description Usage Arguments Value regularization parameters References Examples

View source: R/PreEst.glasso.R

Description

Given a sample covariance matrix S, graphical lasso aims at estimating sparse precision matrix X - inverse of covariance. It solves a following optimization problem,

\textrm{max}_X \log\textrm{det}X - <S,X> - λ \|X \|_1 \textrm{ such that } X \succ 0

where λ a regularization parameter, <S,X>=tr(S^T X) , \|X\|_1 = ∑ X_{ij} and X\succ 0 indicates positive definiteness. We provide three modes of computations, 'fixed','confidence', or 'BIC' with respect to λ. Please see the section below for more details.

Usage

1
PreEst.glasso(X, method = list(type = "fixed", param = 1), parallel = FALSE)

Arguments

X

an (n\times p) data matrix where each row is an observation.

method

a list containing following parameters,

type

one of 'fixed','confidence', or 'BIC'.

param

either a numeric value or vector of values.

parallel

a logical; TRUE for using half the cores available, FALSE otherwise.

Value

a named list containing:

C

a (p\times p) estimated precision matrix.

BIC

a dataframe containing λ values and corresponding BIC scores with type='BIC' method.

regularization parameters

We currently provide three options for solving the problem, 'fixed','confidence', or 'BIC' with respect to λ. When the method type is 'fixed', the parameter should be a single numeric value as a user-defined λ value. Likewise, method type of 'confidence' requires a singule numeric value in (0,1), where the value is set heuristically according to

ρ = \frac{t_{n-2}(γ) \max S_{ii}S_{jj}}{√{n-2+ t_{n-2}^2(γ)}}

for a given confidence level γ \in (0,1) as proposed by Banerjee et al. (2006). Finally, 'BIC' type requires a vector of λ values and opts for a lambda value with the lowest BIC values as proposed by Yuan and Lin (2007).

References

\insertRef

banerjee_convex_2006CovTools

\insertRef

yuan_model_2007CovTools

\insertRef

friedman_sparse_2008CovTools

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## generate data from multivariate normal with Identity precision.
pdim = 10
data = matrix(rnorm(100*pdim), ncol=pdim)

## prepare input arguments for diefferent scenarios
lbdvec <- c(0.01,0.1,1,10,100)              # a vector of regularization parameters
list1 <- list(type="fixed",param=1.0)       # single regularization parameter case
list2 <- list(type="confidence",param=0.95) # single confidence level case
list3 <- list(type="BIC",param=lbdvec)      # multiple regularizers with BIC selection

## compute with different scenarios
out1 <- PreEst.glasso(data, method=list1)
out2 <- PreEst.glasso(data, method=list2)
out3 <- PreEst.glasso(data, method=list3)

## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(2,2), pty="s")
image(diag(pdim)[,pdim:1], main="Original Precision")
image(out1$C[,pdim:1],     main="glasso::lambda=1.0")
image(out2$C[,pdim:1],     main="glasso::Confidence=0.95")
image(out3$C[,pdim:1],     main="glasso::BIC selection")
par(opar)

CovTools documentation built on Aug. 14, 2021, 1:08 a.m.