linshrink: Linear-shrinkage estimator of population eigenvalues.

Description Usage Arguments Value References Examples

View source: R/linshrink.R

Description

linshrink estimates the population eigenvalues from the sample eigenvalues by shrinking each sample eigenvalue towards the global mean based on a shrinkage factor. Details in referenced publications.

Usage

1
linshrink(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

A numeric vector of length ncol(X), containing the population eigenvalue estimates sorted in ascending order.

References

Examples

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

Example output

  [1] 0.8050802 0.8050903 0.8051631 0.8053267 0.8055473 0.8061066 0.8071498
  [8] 0.8081739 0.8092168 0.8093396 0.8103173 0.8108460 0.8114941 0.8132232
 [15] 0.8137912 0.8177468 0.8188483 0.8194978 0.8231025 0.8248160 0.8254778
 [22] 0.8267658 0.8315010 0.8327997 0.8377515 0.8396202 0.8443099 0.8473887
 [29] 0.8509741 0.8537864 0.8547717 0.8592548 0.8611484 0.8656359 0.8686371
 [36] 0.8701481 0.8788579 0.8820094 0.8870900 0.8913351 0.8937496 0.9007947
 [43] 0.9101033 0.9147057 0.9164530 0.9207088 0.9246927 0.9392499 0.9413849
 [50] 0.9426789 0.9580319 0.9594381 0.9707311 0.9768217 0.9776943 0.9939863
 [57] 0.9995288 1.0060234 1.0138601 1.0175546 1.0257774 1.0381181 1.0419845
 [64] 1.0441675 1.0577364 1.0661815 1.0736292 1.0780394 1.0965181 1.1017165
 [71] 1.1066434 1.1216301 1.1368413 1.1528007 1.1555736 1.1638209 1.1727326
 [78] 1.1862483 1.2007393 1.2091180 1.2338206 1.2353960 1.2498319 1.2755629
 [85] 1.2864955 1.3163219 1.3409535 1.3450218 1.3660983 1.3772191 1.4066000
 [92] 1.4222554 1.4527689 1.4651078 1.4823877 1.5351726 1.5795380 1.6222244
 [99] 1.6523957 1.6928017
  [1] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
  [9] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [17] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [25] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [33] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [41] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [49] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [57] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [65] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [73] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [81] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [89] 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707 1.006707
 [97] 1.006707 1.006707 1.006707 1.006707

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

Related to linshrink in nlshrink...