Learn R Programming

novelist (version 1.0)

novelist-package: NOVEL Integration of the Sample and Thresholded (NOVELIST) Correlation and Covariance Estimators

Description

Implements NOVELIST estimator,which is a nonlinear shrinkage estimator of the correlation and covariance matrices and their inverses. It performs shrinkage of the sample correlation matrix towards a thresholding target, yielding the NOVELIST correlation matrix estimator, and then obtain the corresponding NOVELIST covariance matrix estimator by applying the sample variances to the NOVELIST correlation matrix estimator. It also provide NOVELIST estimators of the correlation matrices and the inverse of the covariance/correlation matrices.

Arguments

Details

Package:
novelist
Type:
Package
Version:
1.0
Date:
2015-05-12
License:
GPL (>= 3)
The main routines of the package are novelist.cov.cv and novelist.inv.cv.

References

Huang, N. & Fryzlewicz, P. (2015), "NOVELIST estimator of large correlation and covariance matrices and their inverses". Preprint.

Examples

Run this code
# 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=50

n=50 

cov<-cov.nonsparse(p)

x<-sim.data(cov,n)

novelist.cov.cv(x, lambda=seq(0,1,by=0.1)) # NOVELIST estimator of the covariance matrix

novelist.inv.cv(x, lambda=seq(0,1,by=0.1)) # NOVELIST estimator of the precision matrix

Run the code above in your browser using DataLab