View source: R/CovEst.hardPD.R
| CovEst.hardPD | R Documentation |
Sparse covariance estimation does not necessarily guarantee positive definiteness of an estimated covariance matrix. Fan et al. (2013) proposed to solve this issue by taking an iterative procedure to take an incremental decrease of threshold value until positive definiteness is preserved.
CovEst.hardPD(X)
X |
an |
The selected estimate is verified to have minimum eigenvalue at least
\sqrt{\epsilon}, where \epsilon is machine precision. Since
hard thresholding preserves the diagonal, the function stops with an
informative error when a column variance is below this tolerance and no
qualifying estimate can be constructed.
a named list containing:
a (p\times p) covariance matrix estimate.
a nonnegative threshold value C_{min} that guarantees
positive definiteness after thresholding. A value of zero means that the
sample covariance already satisfies the tolerance.
fan_large_2013CovTools
## generate data from multivariate normal with Identity covariance.
pdim <- 5
data <- matrix(rnorm(10*pdim), ncol=pdim)
## apply 4 different schemes
out1 <- CovEst.hard(data, thr=0.1) # threshold value 0.1
out2 <- CovEst.hard(data, thr=1) # threshold value 1
out3 <- CovEst.hard(data, thr=10) # threshold value 10
out4 <- CovEst.hardPD(data) # automatic threshold checking
## visualize 4 estimated matrices
mmessage <- paste("hardPD::optimal thr=",sprintf("%.2f",out4$optC),sep="")
gcol <- gray((0:100)/100)
opar <- par(no.readonly=TRUE)
par(mfrow=c(2,2), pty="s")
image(out1$S[,pdim:1], col=gcol, main="thr=0.1")
image(out2$S[,pdim:1], col=gcol, main="thr=1")
image(out3$S[,pdim:1], col=gcol, main="thr=10")
image(out4$S[,pdim:1], col=gcol, main=mmessage)
par(opar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.