Description Usage Arguments Value regularization parameters References Examples
View source: R/PreEst.glasso.R
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.
1 | PreEst.glasso(X, method = list(type = "fixed", param = 1), parallel = FALSE)
|
X |
an (n\times p) data matrix where each row is an observation. |
method |
a list containing following parameters,
|
parallel |
a logical; |
a named list containing:
a (p\times p) estimated precision matrix.
a dataframe containing λ values and corresponding BIC scores with type='BIC'
method.
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).
banerjee_convex_2006CovTools
\insertRefyuan_model_2007CovTools
\insertReffriedman_sparse_2008CovTools
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.