Oracle Approximating Shrinkage

The Oracle Approximating Shrinkage (OAS) pulls the sample covariance towards the identity matrix scaled by the average variance, like the Ledoit-Wolf Shrinkage, with an intensity that Chen, Wiesel, Eldar and Hero (2010) derived for normally distributed returns by iterating towards the oracle intensity. It converges faster and shrinks more when there are few periods.

The formula for the Oracle Approximating Shrinkage starts from the sample covariance S of the demeaned returns \(y_{i , t}\) of the N assets over the T periods, divided by T, the average variance nu and the average squared entry A:

\[S_{i,j} = \frac{\sum_{t=1}^{T} y_{i,t} \cdot y_{j,t}}{T}\] \[\nu = \frac{\sum_{i=1}^{N} S_{i,i}}{N}\] \[A = \frac{\sum_{i=1}^{N} \sum_{j=1}^{N} S_{i,j}^{2}}{N^{2}}\]

The intensity delta and the estimate, with I the identity matrix, are:

\[\delta = \min\left(\frac{A + \nu^{2}}{(T + 1) \cdot \left(A - \frac{\nu^{2}}{N}\right)}, 1\right)\] \[\Sigma = (1 - \delta) \cdot S + \delta \cdot \nu \cdot I\]

It suits short histories of returns that are close to normal; with fat tails, the assumption behind the intensity no longer holds.

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: OAS, OAS covariance.

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

Which returns:

References

  • Paper Chen, Y., Wiesel, A., Eldar, Y. C. and Hero, A. O. (2010). “Shrinkage Algorithms for MMSE Covariance Estimation.” IEEE Transactions on Signal Processing, 58(10), 5016-5029.
  • Library Referenced against scikit-learn’s OAS (Oracle Approximating Shrinkage)
  • Library Shares similar logic as PyPortfolioOpt’s CovarianceShrinkage.oracle_approximating (Oracle Approximating Shrinkage)
Share