Geodesic Shrinkage

The Geodesic Shrinkage moves the sample covariance towards the identity matrix scaled by the average variance along the geodesic of the positive definite matrices, the shortest path between the two in their natural geometry, rather than along a straight line (Bhatia, 2007; Musolas, Smith and Marzouk, 2021).

The formula for the Geodesic Shrinkage starts from the sample covariance S (ddof=1) of the N assets and the target F, the identity matrix I times the average variance nu:

\[\nu = \frac{\sum_{i=1}^{N} S_{i,i}}{N}\] \[F = \nu \cdot I\]

It takes the point at the share delta of the way along the geodesic, which keeps the eigenvectors \(v_{k}\) of S and interpolates its eigenvalues \(\lambda_{k}\) geometrically:

\[\Sigma = S^{1/2} \cdot \left(S^{-1/2} \cdot F \cdot S^{-1/2}\right)^{\delta} \cdot S^{1/2}\] \[\Sigma = \sum_{k=1}^{N} \lambda_{k}^{1 - \delta} \cdot \nu^{\delta} \cdot v_{k} \cdot v'_{k}\]

The smallest eigenvalues rise and the largest fall in proportion, so the matrix stays positive definite and better conditioned for every delta, where a straight-line shrinkage moves the eigenvalues by the same amount.

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: geodesic covariance, Riemannian shrinkage.

In the Finance Toolkit this is get_covariance_estimate with method="geodesic", 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="geodesic")

Which returns:

References

  • Paper Bhatia, R. (2007). “Positive Definite Matrices.” Princeton University Press.
  • Paper Musolas, A., Smith, S. T. and Marzouk, Y. (2021). “Geodesically Parameterized Covariance Estimation.” SIAM Journal on Matrix Analysis and Applications, 42(2), 528-556.
  • Library Referenced against skfolio’s GeodesicShrinkageCovariance (Geodesic Shrinkage)
Share