Description Usage Arguments Details Value References See Also Examples
View source: R/novelist.inv.cv.R
Optimal NOVELIST estimator of the inverse of a covariance/correlation matrix.
1 2 |
x |
a n by p data matrix or p by p sample correlation/covariance matrix, where p is dimension and n is sample size. |
data |
|
is.cov |
only valid when |
lambda |
a series of thresholding levels, for example |
delta |
a series of shrinkage intensities, for example |
CV |
empirical optimal parameters (λ*,δ*) are chosen from an semi-analytical method if |
CV.inv.cov |
only valid when |
Th.method |
thresholding method. Soft thresholding is used if |
rep.cv |
repetition times for cross validation. |
First, NOVELIST performs shrinkage of the sample correlation matrix towards a thresholding target, yielding the NOVELIST correlation matrix estimator, which has 2 parameters. The NOVELIST correlation estimator can be obtained by either assigned parameters or empirical optimal parameters which are automatically chosen from a semi-analytical method. The method combines Ledoit-Wolf's lemma (Ledoit and Wolf, 2003) and cross validation. First, for each thresholding level λ, it applies Ledoit-Wolf's method to choose the optimal empirical shrinkage intensity δ*(λ), and then pick out the best pair of (λ, δ*(λ)) which reaches the minimal spectral norm error by cross validation, and denote it as (λ*, δ*), then the final NOVELIST correlation estimator is calculated using (λ*, δ*). This process significantly accelerates the computing speed. Second, the method obtains the corresponding NOVELIST covariance matrix estimator by applying the sample variances to the NOVELIST correlation matrix estimator. The details are explained in Huang and Fryzlewicz (2015).
inv.cov.novel |
NOVELIST estimator of the inverse of the covariance matrix. |
inv.cor.novel |
NOVELIST estimator of the inverse of the correlation matrix. |
lambda.star |
empirical choice of thresholding. |
delta.star |
empirical choice of shrinkage intensity. |
If data=TRUE
, both inv.cov.novel
and inv.cor.novel
are computed.
If data=FALSE
and is.cov=TRUE
, both inv.cov.novel
and inv.cor.novel
are computed.
If data=FALSE
and is.cov=FALSE
, only inv.cor.novel
is computed.
lambda.star
and delta.star
are only computed when CV=TRUE
.
Huang, N. & Fryzlewicz, P. (2015), "NOVELIST estimator of large correlation and covariance matrices and their inverses". Preprint..
Ledoit, O., & Wolf, M.(2003), "Improved estimation of the covariance matrix of stock returns with an application to portfolio selection." Journal of Empirical Finance
10, 603-621.
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # 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 x 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=30
n=30
cov<-cov.nonsparse(p)
x<-sim.data(cov,n)
# input n x p data matrix and assign parameters
novelist.inv.cv(x,lambda=c(0,0.5),delta=c(0,0.5,1),CV=FALSE)
# input n x p data matrix and find optimal parameters for covariance estimator
# achieves the least error to the true covariance matirx via cross validation
novelist.inv.cv(x, lambda=seq(0,1,by=0.1))
# input n x p data matrix and find optimal parameters for correlation estimator
# achieves the least error to the true correlation matirx via cross validation
novelist.inv.cv(x, lambda=seq(0,1,by=0.1), CV.inv.cov=FALSE)
# input covariance matrix and assign parameters
novelist.inv.cv(cov(x),data=FALSE,lambda=c(0,0.5),delta=c(0,0.5,1),CV=FALSE)
# input correlation matrix and assign parameters
novelist.inv.cv(cor(x),data=FALSE,is.cov=FALSE,lambda=c(0,0.5),delta=c(0,0.5,1),CV=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.