Fixed Shrinkage

The Fixed Shrinkage pulls the sample covariance towards the identity matrix scaled by the average variance, the target of Ledoit and Wolf (2004), by an intensity that is chosen rather than estimated.

The formula for the Fixed Shrinkage is as follows:

\[\Sigma = (1 - \delta) \cdot S + \delta \cdot \nu \cdot I\]

Where S is the sample covariance (ddof=1), nu the average of its diagonal, the average variance, I the identity matrix and delta the intensity between 0 (the sample covariance) and 1 (the scaled identity). It gives a predictable amount of shrinkage for every sample, where the estimated intensities change with it.

Its parameters can be set, and it can be shown as a correlation matrix. The covariance matrix holds the variance of every asset and the covariance of every pair, the risk input of the mean-variance analysis of Markowitz (1952). With N assets it holds N (N + 1) / 2 numbers to estimate, and when N is not small compared to the number of periods T, the sample estimate is noisy and ill-conditioned: its smallest eigenvalues come out too small, and an optimizer that inverts it puts large weights on the combinations of assets that only look safe in the sample. The estimators differ in how they deal with this: by shrinking towards a structured target, by cleaning the eigenvalues, by weighting recent periods, by counting only large moves or by resisting outliers. Every estimate is annualized with the number of periods in a year.

Also known as: shrunk covariance, constant shrinkage.

In the Finance Toolkit this is get_covariance_estimate with method="shrunk", the same function as Covariance Estimate.

Example · AAPL, MSFT, JNJ, XOM · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_covariance_estimate:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["AAPL", "MSFT", "JNJ", "XOM"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.portfolio.get_covariance_estimate(method="shrunk")

Which returns:

References

  • Paper Ledoit, O. and Wolf, M. (2004). “A Well-Conditioned Estimator for Large-Dimensional Covariance Matrices.” Journal of Multivariate Analysis, 88(2), 365-411.
  • Library Referenced against PyPortfolioOpt’s CovarianceShrinkage.shrunk_covariance (Fixed Shrinkage)
  • Library Shares similar logic as scikit-learn’s ShrunkCovariance (Fixed Shrinkage)
  • Library Shares similar logic as skfolio’s ShrunkCovariance (Fixed Shrinkage)
  • Library Shares similar logic as Riskfolio-Lib’s covar_matrix (Fixed Shrinkage)
Share