Minimum Covariance Determinant

The Minimum Covariance Determinant (MCD) is the covariance of the half of the periods whose covariance matrix has the smallest determinant, the most tightly packed periods, reweighted for efficiency (Rousseeuw and Van Driessen, 1999). Crashes and data errors barely move it, as up to almost half the periods can be outliers.

The formula for the Minimum Covariance Determinant starts from the number of periods h it keeps of the T periods of the N assets:

\[h = \left\lceil \frac{T + N + 1}{2}\right\rceil\]

The raw estimate, the average \(m_{0}\) and the covariance Sigma_0 of the h periods with the smallest covariance determinant, made consistent at the normal distribution, gives every period its squared Mahalanobis distance, with \(y_{t} = r_{t} - m_{0}\) the deviation of its returns:

\[d_{t}^{2} = y'_{t} \cdot \Sigma_{0}^{-1} \cdot y_{t}\]

The periods with \(d_{t}^{2}\) at most \(Q_{N} (0.975)\), the 0.975 quantile of the chi-squared distribution with N degrees of freedom, are kept, and their covariance \(S_{1}\) (divided by their number) is scaled by the consistency factor c of Croux and Haesbroeck (1999), with \(F_{N + 2}\) the chi-squared distribution function with N + 2 degrees of freedom:

\[c = \frac{0.975}{F_{N+2}(Q_{N}(0.975))}\] \[\Sigma = c \cdot S_{1}\]

It shows the co-movement of ordinary periods; the periods it leaves out are those a stress test would look at.

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: MCD, FastMCD, robust covariance.

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

Which returns:

References

  • Paper Rousseeuw, P. J. and Van Driessen, K. (1999). “A Fast Algorithm for the Minimum Covariance Determinant Estimator.” Technometrics, 41(3), 212-223.
  • Paper Croux, C. and Haesbroeck, G. (1999). “Influence Function and Efficiency of the Minimum Covariance Determinant Scatter Matrix Estimator.” Journal of Multivariate Analysis, 71(2), 161-190.
  • Library Referenced against scikit-learn’s MinCovDet (Minimum Covariance Determinant)
Share