Compute the Ledoit and Wolf shrinkage estimator of the covariance matrix (Ledoit and Wolf 2004) , which can be used for the initial inverse covariance matrix in ggmncv.

ledoit_wolf(Y, ...)

Arguments

Y

A data matrix (or data.frame) of dimensions n by p.

...

Currently ignored.

Value

Inverse correlation matrix.

References

Ledoit O, Wolf M (2004). “A well-conditioned estimator for large-dimensional covariance matrices.” Journal of Multivariate Analysis, 88(2), 365--411.

Examples


# ptsd
Y <- ptsd[,1:5]

# shrinkage
ledoit_wolf(Y)
#>            B1          B2         B3          B4         B5
#> B1  1.7481888 -0.40369737 -0.1292942 -0.59450245 -0.2768127
#> B2 -0.4036974  1.91707343 -0.9664283  0.03540245 -0.2046325
#> B3 -0.1292942 -0.96642834  2.1197014 -0.43273664 -0.3563303
#> B4 -0.5945024  0.03540245 -0.4327366  1.92211201 -0.6171229
#> B5 -0.2768127 -0.20463250 -0.3563303 -0.61712287  1.7916529

# non-reg
solve(cor(Y))
#>            B1          B2         B3          B4         B5
#> B1  1.8038784 -0.43079211 -0.1181438 -0.63367318 -0.2829828
#> B2 -0.4307921  2.00902137 -1.0592620  0.06464077 -0.2066964
#> B3 -0.1181438 -1.05926201  2.2398875 -0.46685141 -0.3751841
#> B4 -0.6336732  0.06464077 -0.4668514  2.00050585 -0.6560128
#> B5 -0.2829828 -0.20669638 -0.3751841 -0.65601277  1.8525881