CovEst.nearPD {CovTools} R Documentation

## Covariance Estimation via Nearest Positive-Definite Matrix Projection

### Description

Qi and Sun (2006) proposed an algorithm for computing the positive correlation matrix with Positive Definiteness and transforming it back in order to estimate covariance matrix. This algorithm does not depend on any parameters.

### Usage

CovEst.nearPD(X)


### Arguments

 X an (n\times p) matrix where each row is an observation.

### Value

a named list containing:

S

a (p\times p) covariance matrix estimate.

### References

Qi H, Sun D (2006). “A Quadratically Convergent Newton Method for Computing the Nearest Correlation Matrix.” SIAM Journal on Matrix Analysis and Applications, 28(2), 360–385. ISSN 0895-4798, 1095-7162.

### Examples

## generate data from multivariate normal with Identity covariance.
pdim <- 5
data <- matrix(rnorm(10*pdim), ncol=pdim)

## compare against sample covariance
out1 <- cov(data)
out2 <- CovEst.nearPD(data) # apply nearPD

## visualize 2 estimated matrices
gcol <- gray((0:100)/100)