# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.descriptive.covariance

## Class LedoitWolf2004

• java.lang.Object
• com.numericalmethod.suanshu.stats.descriptive.covariance.LedoitWolf2004

• public class LedoitWolf2004
extends Object
To estimate the covariance matrix, Ledoit and Wolf (2004) suggests using the matrix obtained from the sample covariance matrix through a transformation called shrinkage. This tends to pull the most extreme coefficients towards more central values, thereby systematically reducing estimation error where it matters most. Statistically, the challenge is to know the optimal shrinkage intensity, and they also give the formula for that.

Note: The input matrix here is T-by-N, while the description in the referenced paper assumes the matrix of stock returns is N-by-T.

• Olivier Ledoit and Michael Wolf, "Honey, I Shrunk the Sample Covariance Matrix," in Journal of Portfolio Management, Volume 31, Number 1, 2004.
• Olivier Ledoit and Michael Wolf, "Improved Estimation of the Covariance Matrix of Stock Returns With an Application to Portfolio Selection," in Journal of Empirical Finance, Volume 10, Issue 5, December 2003, pages 603-621.
• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
static class  LedoitWolf2004.Result
The estimator and some intermediate values computed by the algorithm.
• ### Constructor Summary

Constructors
Constructor and Description
LedoitWolf2004()
Creates the algorithm instance, using an unbiased sample covariance matrix by default.
LedoitWolf2004(boolean unbiased)
Creates the algorithm instance, with the option to use an unbiased or biased sample covariance matrix.
• ### Method Summary

All Methods
Modifier and Type Method and Description
LedoitWolf2004.Result compute(Matrix Y)
Estimates the covariance matrix for a given matrix Y (each column in Y is a time-series), with the optimal shrinkage parameter computed by the algorithm.
LedoitWolf2004.Result compute(Matrix Y, double shrinkage)
Estimates the covariance matrix for a given matrix Y (each column in Y is a time-series), with the given shrinkage parameter.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### LedoitWolf2004

public LedoitWolf2004()
Creates the algorithm instance, using an unbiased sample covariance matrix by default.
• #### LedoitWolf2004

public LedoitWolf2004(boolean unbiased)
Creates the algorithm instance, with the option to use an unbiased or biased sample covariance matrix.
Parameters:
unbiased - true to use unbiased covariance matrix
• ### Method Detail

• #### compute

public LedoitWolf2004.Result compute(Matrix Y)
Estimates the covariance matrix for a given matrix Y (each column in Y is a time-series), with the optimal shrinkage parameter computed by the algorithm.
Parameters:
Y - the input matrix
Returns:
the estimator
• #### compute

public LedoitWolf2004.Result compute(Matrix Y,
double shrinkage)
Estimates the covariance matrix for a given matrix Y (each column in Y is a time-series), with the given shrinkage parameter.
Parameters:
Y - the input matrix
shrinkage - the shrinkage parameter
Returns:
the estimator