diff --git a/README.md b/README.md index eee716a..56fe53a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ | [![Build Status](https://travis-ci.com/mateuszbaran/CovarianceEstimation.jl.svg?branch=master)](https://travis-ci.com/mateuszbaran/CovarianceEstimation.jl) [![Build status](https://ci.appveyor.com/api/projects/status/7riq3mtk8wy6k3yl?svg=true)](https://ci.appveyor.com/project/mateuszbaran/covarianceestimation-jl) | [ ![codecov.io](http://codecov.io/github/mateuszbaran/CovarianceEstimation.jl/coverage.svg?branch=master)](http://codecov.io/github/mateuszbaran/CovarianceEstimation.jl?branch=master) | # CovarianceEstimation.jl -Lightweight covariance estimation in Julia. +Lightweight robust covariance estimation in Julia. The package is currently unregistered but can be installed with `Pkg` using ```julia-repl @@ -14,29 +14,37 @@ The package is currently unregistered but can be installed with `Pkg` using ```julia using CovarianceEstimation -using Random X = randn(5, 3) -S_uncorrected = cov(Simple(), X) -S_corrected = cov(Corrected(), X) - -# using optimal shrinkage -S_ledoitwolf = cov(LedoitWolf(), X) -S_rbledoitwolf = cov(RaoBlackwellLedoitWolf(), X) -S_oracleapprox = cov(OracleApproximatingShrinkage(), X) - +S_uncorrected = cov(X, Simple()) +S_corrected = cov(X, Simple(corrected=true)) + +# using shrinkage with different targets +# - Ledoit-Wolf target + shrinkage +method = LinearShrinkageEstimator(ConstantCorrelation()) +S_ledoitwolf = cov(X, method) +# - Chen target + shrinkage +method = LinearShrinkageEstimator(DiagonalCommonVariance(), :rblw) +S_chen_rblw = cov(X, method) +method = LinearShrinkageEstimator(DiagonalCommonVariance(), :oas) +S_chen_oas = cov(X, method) + +# a pre-defined shrinkage can be used as well +method = LinearShrinkageEstimator(DiagonalUnitVariance(), 0.5) # using a given shrinkage -S_ledoitwolf_05 = cov(LedoitWolf(0.5), X) +S_05 = cov(X, method) ``` ## Currently supported algorithms -* Basic corrected and uncorrected sample covariance (via the `Statistics` package), -* Ledoit-Wolf shrinkage [**1**], -* Rao-Blackwell Ledoit-Wolf shrinkage and Oracle Approximating shrinkage [**2**]. +* `Simple`: basic corrected and uncorrected sample covariance (via the `Statistics` package), +* `LinearShrinkageEstimator`: James-Stein type estimator of the form `(1-λ)S+λF` where `S` is the uncorrected simple estimator, `F` is a target and `λ∈[0,1]` a shrinkage intensity. + - common targets are implemented following the taxonomy given in [**1**] along with Ledoit-Wolf optimal shrinkage intensities [**2**]. + - in the case of the `DiagonalCommonVariance` target, a Rao-Blackwellised intensity and Oracle-Approximating intensity are also supported (see [**3**]). ## References -* [**1**] O. Ledoit and M. Wolf, *[Honey, I Shrunk the Sample Covariance Matrix](http://www.ledoit.net/honey.pdf)*, The Journal of Portfolio Management, vol. 30, no. 4, pp. 110–119, Jul. 2004. -* [**2**] Y. Chen, A. Wiesel, Y. C. Eldar, and A. O. Hero, *[Shrinkage Algorithms for MMSE Covariance Estimation](https://arxiv.org/pdf/0907.4698.pdf)*, IEEE Transactions on Signal Processing, vol. 58, no. 10, pp. 5016–5029, Oct. 2010. +* [**1**] J. Schäfer and K. Strimmer, *[A Shrinkage Approach to Large-Scale Covariance Matrix Estimation and Implications for Functional Genomics](http://strimmerlab.org/publications/journals/shrinkcov2005.pdf)*, Statistical Applications in Genetics and Molecular Biology, 2005. +* [**2**] O. Ledoit and M. Wolf, *[Honey, I Shrunk the Sample Covariance Matrix](http://www.ledoit.net/honey.pdf)*, The Journal of Portfolio Management, 2004. +* [**3**] Y. Chen, A. Wiesel, Y. C. Eldar, and A. O. Hero, *[Shrinkage Algorithms for MMSE Covariance Estimation](https://arxiv.org/pdf/0907.4698.pdf)*, IEEE Transactions on Signal Processing, 2010.