Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Drawing the ellipse around the normal data
When two measurements move together, like an engine’s fuel flow and its thrust, a reading can be unremarkable on each axis yet impossible as a pair: high fuel flow with low thrust. The right yardstick is an ellipse fitted to the normal data, stretched along the direction in which the variables co-vary. Points outside the ellipse are anomalies. The catch is that if you fit the ellipse to all the data, the anomalies stretch it until it swallows them. The Minimum Covariance Determinant fits the ellipse to the tightest majority of the data instead.
Many health-monitoring signals are correlated: pressures and temperatures along a duct, currents and torques in an actuator, residuals of a state estimator. Robust Mahalanobis distance is the workhorse for multivariate limit checking and for screening calibration data, and it underlies robust PCA and robust regression diagnostics.
- 1. Mahalanobis distance accounts for…
- 2. Fitting the ellipse to all data, including outliers, tends to…
- 3. MCD fits the ellipse to…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Mahalanobis distance and χ² cut-offs by hand
Squared Mahalanobis distance. d²(x) = (x − μ)ᵀ Σ⁻¹ (x − μ). With μ = 0 and Σ = diag(4, 1), the point (2, 0) has d² = 4/4 = 1: two units along a direction with variance 4 is only one “standard deviation”.
Correlation matters. With unit variances and correlation 0.9:
- (1, 1), along the correlation, has d² = 0.2/0.19 = 1.05;
- (1, −1), against it, has d² = 3.8/0.19 = 20.
Both have the same Euclidean distance √2.
Cut-offs. If x is Gaussian in p dimensions, d² follows a χ² distribution with p degrees of freedom. The 97.5% cut-offs are 7.378 for p = 2, 9.348 for p = 3 and 20.48 for p = 10. About 2.5% of clean points exceed them.
MCD objective. Among all subsets of h points, choose the one whose sample covariance has the smallest determinant: the smallest-volume ellipse holding h points. The usual choice is h = ⌊(n + p + 1)/2⌋, which gives 202 for n = 400, p = 3.
The steps in plain English (FAST-MCD):
- Draw many random (p + 1)-point starting subsets.
- C-step: compute the mean and covariance of the current subset, then keep the h points with the smallest Mahalanobis distances. Repeat until the determinant stops decreasing.
- Keep the best subset over all starts.
- Rescale the covariance for consistency: multiply by median(d²)/χ²₀.₅,ₚ, where χ²₀.₅,ₚ is 1.386 for p = 2.
- Reweight: refit the mean and covariance on the points with d² ≤ χ²₀.₉₇₅,ₚ. Flag points beyond the same cut-off.
- 1. For Gaussian data in p dimensions, d² follows…
- 2. A C-step keeps…
- 3. The default h for MCD is about…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.Breakdown, efficiency and why C-steps work
C-step theorem (Rousseeuw and Van Driessen, 1999). If H₂ is the set of h points with the smallest distances under the mean and covariance of H₁, then det(Σ_H₂) ≤ det(Σ_H₁), with equality only if the estimates coincide. So C-steps converge, usually in a few iterations, to a local minimum. Many random starts make finding the global one likely.
Breakdown point. The fraction of contamination that can drive the estimate arbitrarily far. For the classical mean and covariance it is 1/n, essentially zero. For MCD it is about (n − h)/n, approaching 50% for h ≈ n/2.
Efficiency. A small h discards many good points, so the estimate is noisier on clean data. Larger h (for example 0.75n) is more efficient but tolerates at most about 25% contamination. Reweighting recovers much of the lost efficiency.
Exercise 1 (400 correlated normal points in 3-D plus 100 clustered outliers, 20%):
- the classical ellipse flagged 0% of the outliers, completely masked;
- MCD flagged 100%, with false-alarm rates of 2.2% (classical) and 2.8% (MCD);
- MCD’s correlation estimate was 0.79 (true 0.8), and its location was within 0.15 of the true centre.
from sklearn.covariance import MinCovDet, EllipticEnvelope
mcd = MinCovDet(support_fraction=None, random_state=0).fit(X); d2 = mcd.mahalanobis(X) # robust squared distances
flags = EllipticEnvelope(contamination=0.05, random_state=0).fit(X).predict(X) == -1- 1. Each C-step makes the covariance determinant…
- 2. The classical covariance's breakdown point is…
- 3. Larger h makes MCD…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Affine equivariance. MCD’s location and scatter transform correctly under any invertible affine map x ↦ Ax + b, so robust distances do not depend on units or rotations. This is unlike coordinate-wise median/MAD rules.
Breakdown versus capture. The breakdown point guarantees the estimate stays bounded under up to about 50% contamination. It does not guarantee the estimate stays on the majority. A tight outlier cluster has a tiny covariance determinant, so an h-subset built around it can have a smaller determinant than any subset of genuine inliers. In p dimensions, a cluster with scatter s² per axis has determinant proportional to s^(2p), so this effect grows quickly with dimension.
Dimension limits. MCD needs n comfortably larger than p, as a rule of thumb n > 5p, and its cost and the number of starts needed grow with p. For high dimensions, use regularised MCD (MRCD), robust PCA first, or other detectors. With non-elliptical normal data, such as multimodal or skewed data, any single ellipse is the wrong model.
Interview questions.
- Why use robust Mahalanobis distance instead of per-variable z-scores? It sees violations of the correlation structure, it is affine equivariant, and it resists masking by up to roughly half the data when the outliers are spread out.
- How should n_starts and h be chosen? Use h ≈ n/2 when contamination is unknown and possibly large, and h ≈ 0.75n for better efficiency when it is known to be small. Use enough starts (hundreds in sklearn’s implementation) for the best subset to be found.
- 1. Affine equivariance means robust distances are unchanged by…
- 2. A tight outlier cluster can capture MCD below 50% contamination because…
- 3. For p close to n, use…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.Where does each estimator break?
History.
- P. C. Mahalanobis (1936) introduced the distance.
- P. Rousseeuw (1984) introduced the MCD and minimum volume ellipsoid estimators.
- P. Rousseeuw and K. Van Driessen (1999) introduced FAST-MCD and the C-step.
- M. Hubert, P. Rousseeuw and S. Van Aelst (2008) reviewed high-breakdown multivariate methods.
- K. Boudt et al. (2020) introduced MRCD for high dimensions.
Exercise 2. 400 points in 3-D: correlated normal inliers plus a fraction ε of outliers clustered at (3, −3, 0) with covariance 0.1I; 2 datasets. Each cell gives recall, then false-alarm rate, at the 97.5% χ² cut-off.
| ε | classical | MCD, h = 0.75n | MCD, h ≈ n/2 |
|---|---|---|---|
| 0.05 | 1.00, 0.016 | 1.00, 0.037 | 1.00, 0.039 |
| 0.15 | 0.00, 0.021 | 1.00, 0.029 | 1.00, 0.032 |
| 0.30 | 0.00, 0.034 | 0.00, 0.159 | 1.00, 0.034 |
| 0.35 | 0.00, 0.048 | 0.00, 0.202 | 0.00, 0.267 |
| 0.45 | 0.00, 0.084 | 0.00, 0.420 | 0.00, 0.384 |
- The classical ellipse was fully masked by 15% clustered outliers.
- MCD with h = 0.75n broke between 15% and 30%, as its 25% breakdown point predicts. Once broken, it centred on the outliers and flagged 16–42% of the inliers.
- MCD with h ≈ n/2 survived 30% but broke at 35%, well below its nominal 50%. The outliers’ covariance 0.1I has determinant 0.001, so h-subsets built around the cluster are tighter than any subset of inliers. At ε = 45%, the inlier-only subset had determinant 0.353 against 0.021 for the cluster-led one.
- Breakdown points describe the worst case for bounded estimates, not the contamination level at which detection still works. Tight, coherent outlier clusters, which are typical of a systematic fault, are the hardest case.
Robust covariance in AI, robotics and aerospace
- Multivariate limit checking: robust distance of correlated sensor residuals detects faults that no single channel shows.
- Calibration data screening: MCD-based outlier removal before fitting sensor models, so that bad calibration points do not bias them.
- State-estimator health: robust distances of innovation vectors in a Kalman filter, with χ² cut-offs, as a robust normalised innovation squared (NIS) test.
References
- P. J. Rousseeuw (1984). “Least median of squares regression.” Journal of the American Statistical Association 79(388).
- P. J. Rousseeuw, K. Van Driessen (1999). “A fast algorithm for the minimum covariance determinant estimator.” Technometrics 41(3).
- M. Hubert, P. J. Rousseeuw, S. Van Aelst (2008). “High-breakdown robust multivariate methods.” Statistical Science 23(1).
- K. Boudt, P. J. Rousseeuw, S. Vanduffel, T. Verdonck (2020). “The minimum regularized covariance determinant estimator.” Statistics and Computing 30.