Learn R Programming

cernn (version 0.1)

shrink_eigen: Nonlinear shrinkage of sample eigenvalues

Description

shrink_eigen shrinks the sample eigenvalues.

Usage

shrink_eigen(d, lambda, alpha, n)

Arguments

d
Vector of sample eigenvalues to shrink. These must be nonnegative.
lambda
Regularization parameter controling amount of shrinkage towards the target.
alpha
Parameter that controls mixture between the trace and inverse trace penalties.
n
The number of observations.

Value

Vector of shrunken eigenvalues.

Examples

Run this code
set.seed(12345)
nLambda <- 100
lambda <- 10**seq(-2,2,length.out=nLambda)
alpha <- 0.5
n <- 10
p <- 5
d <- sort(2*runif(p))
e <- shrink_eigen(d,lambda,alpha,n)

## Plot regularization paths of eigenvalues
matplot(x=log10(lambda),y=t(e),type='l',ylab='shrunken eigenvalue')

Run the code above in your browser using DataLab