Description Usage Arguments Value See Also Examples
Obtain a series of soft thresholding estimators of a covariance/correlation matrix by applying a series of thresholdings.
1 |
m |
a p by p sample covaraince matrix. |
th |
a series of thresholding levels, for example |
Cor |
apply soft thresholding on sample covariance matrix if |
An array of covariance matrix estimators after regularized by a series of thresholding levels.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # arbitrary positive definite covariance matrix
cov.nonsparse<- function(p, rgen = rnorm, rgen.diag = rchisq, df = 5)
{
m <- matrix(rgen(p*p), p, p)
m[upper.tri(m)] <- 0
tmp <- m %*% t(m)
tmp.svd <- svd(tmp)
tmp.svd$d <- rgen.diag(p, df)
tmp.svd$u %*% diag(tmp.svd$d) %*% t(tmp.svd$u)
}
# simulate n by p data matrix by a given covariance matrix
sim.data <- function(sc, n, rgen = rnorm)
{
l <- t(chol(sc))
p <- dim(sc)[1]
z <- matrix(rgen(p * n), p, n)
t(l %*% z)
}
p=100
n=100
cov<-cov.nonsparse(p)
data<-sim.data(cov,n)
# an array of soft thresholding estimators for the covariance matrix
# apply thresholdings from 0 to 1 to the sample correlation matrix
s.cov<-softt(cov(t(data)),seq(0,1,by=0.05))
s.cov[,,5] # the soft thresholding estimator when the thresholding level is 0.2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.