linshrink_cov: Linear-shrinkage estimator of population covariance matrix.

Description Usage Arguments Value References Examples

View source: R/linshrink.R

Description

The linear shrinkage estimator of the population covariance matrix is computed by shrinking the sample covariance matrix towards the identity matrix based on a shrinkage factor. Note that the eigenvalues of the population covariance matrix estimate are not the same as the linear shrinkage estimates of population eigenvalues. Details in referenced publication.

Usage

1
linshrink_cov(X, k = 0)

Arguments

X

A data matrix.

k

(Optional) Non-negative integer less than ncol(X). If k == 0 (default), X is assumed to contain 1 class, which will be centered. If k >= 1, X is assumed to contain k classes, each of which has already been centered.

Value

Population covariance matrix estimate. A square positive semi-definite matrix of dimension ncol(X).

References

Examples

1
2
linshrink_cov(X = matrix(rnorm(1e4, mean = 5), nrow = 100, ncol = 100)) # 1 class; will be centered
linshrink_cov(X = matrix(rnorm(1e4), nrow = 100, ncol = 100), k = 1) # 1 class; no centering

nlshrink documentation built on May 1, 2019, 8:42 p.m.