View source: R/threshold_operator.R
| thresh_op | R Documentation |
This function computes the thresholding sparse covariance estimator for a given threshold level.
thresh_op(z, operator, delta, n)
z |
The sample covariance matrix. |
operator |
The choice of the thresholding operator. |
delta |
The thresholding level. |
n |
The sample size of data matrix. |
The thresholding sparse covariance estimator for a given threshold level.
## generate data from a block diagonal covariance matrix structure
n <- 50
p <- 30
data.true.cov <- block.true.cov(p)
data <- sampleMVN(n, data.true.cov, sparse=TRUE)
## compute the sample covariance
z <- Rfast::cova(data) *(n-1)/n
## get the sparse covariance matrix estimator for a given threshold level
s <- thresh_op(z, operator='soft', delta=1, n=n)
s[1:9,1:9]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.