How this calculation works
Enter complete multivariate rows and a subset size h larger than the feature dimension. Smaller h concentrates on a smaller core of the sample.
H*=argmin|H|=h det[(1/h)Σi∈H(xᵢ−μH)(xᵢ−μH)ᵀ].A worked example
Default support0..4 has center(0.5,0.45), covariance diag(0.2,0.21), covariance off diagonal0, determinant0.042. Raw divisor is h; no consistency scaling or reweighting.
Good to know
2–3 dimensions, 6–20 complete observations and p+1≤h<n; enumerate at most100000 subsets; raw MCD covariance explicitly unscaled, divisor h; return every tied minimum subset up to20 and exact combinatorial search completion. Singular optimum is reported as degenerate, no invented positive covariance or calibrated outlier p-values.
Reference: scikit-learn official MCD definition and references (opens in a new tab) ↗
Choose a raw support size before searching
Enter complete multivariate rows and a subset size h larger than the feature dimension. Smaller h concentrates on a smaller core of the sample.
The method assumes one main approximately elliptical population. A separate genuine cluster can otherwise be classified as an outlying group of rows.
Compare this with the Mardia multivariate skewness and kurtosis test calculator. Find an h-observation subset minimizing covariance determinant, then return its robust location, raw scatter and row distances. Mardia uses every observation and tests multivariate normality; it does not estimate contamination-resistant scatter or return an optimizing subset.
Minimize covariance volume over the bounded subset family
For every h-row subset, calculate its mean and covariance using divisor h. The determinant is proportional to squared ellipsoid volume.
The exhaustive bounded search returns an optimizing subset witness. It does not rely on a random fast-MCD start finding the global minimum. The default eight points contain a compact five-point core and three distant observations. With h=5 the minimizing subset is rows0 through4, with center(0.5,0.45) and raw covariance diagonal entries0.2 and0.21. Its determinant is0.042. The distant points do not enter this subset simply because they dominate ordinary variance. This is the defining robust-subset question: select h rows whose covariance ellipsoid has the smallest volume measure, rather than trim rows after fitting the usual all-observation covariance.
Keep raw covariance separate from corrected estimates
These outputs are raw subset scatter and location. No normal-consistency factor or reweighting step is silently added.
Corrected robust covariance from another package may therefore differ even when it chooses the same support. Compare its raw covariance before diagnosing a disagreement.
Work through the checked default example
Default support0..4 has center(0.5,0.45), covariance diag(0.2,0.21), covariance off diagonal0, determinant0.042. Raw divisor is h; no consistency scaling or reweighting.
All 56 five-row subsets are inspected. The optimizing first five rows give raw location (0.5,0.45), raw covariance diagonal (0.2,0.21) and determinant 0.042; the distant rows have squared robust distances above 799. The determinant is minimized by enumerating every allowed h-subset within the combinatorial cap. The number of subsets is n choose h, so a moderate increase in n can create a large workload. Completeness is a meaningful distinction from a random-start robust approximation. Covariances use divisor h and remain raw: no consistency multiplier, finite-sample correction or reweighting pass is applied. Consequently these numbers will not necessarily equal a library's fully corrected MCD defaults, even if both implementations identify the same core observations. Compare conventions before calling that difference a numerical error.
Measure distances from the robust center
Squared Mahalanobis distances use the selected raw covariance inverse. A distant row can have a large distance even when ordinary full-sample scatter masks it.
Those distances are descriptive here. The raw support selection changes their reference distribution, so an ordinary chi-square tail is not an automatic outlier p value.
Report degenerate optima rather than regularizing invisibly
A collinear or duplicate-row subset can have zero determinant. That is a singular optimum, not a usable positive-definite covariance estimate.
Adding a ridge would solve a different optimization problem. A different h or more varied data may be needed before robust distances can be calculated. A singular subset has zero determinant and can be the exact minimum for data concentrated on a line. That is a degenerate scatter result, not evidence for a tiny well-defined full-dimensional ellipsoid. The page returns the degenerate status and withholds inverse-covariance distances. For a nonsingular minimum, squared Mahalanobis distances are descriptive distances from the selected raw scatter; they are not calibrated outlier p-values. Units also matter: rescaling one coordinate changes the covariance entries and determinant predictably, while the optimizing subset should remain invariant under a nonsingular common affine transformation when numerical conditioning is adequate.
Recognize the combinatorial cost
There are n choose h candidate subsets. The strict cap keeps exhaustive completion and the optimizing witness reviewable on a small input.
Affine transformations preserve the support criterion up to a common determinant multiplier. This provides a useful independent check on translation and coordinate scaling. The displayed subset uses zero-based row indices, so the first five rows are0,1,2,3,4. Save their actual observations with the index list if the source dataset may be reordered later. Tied minimum subsets can exist; the interface prints a bounded number rather than claiming that one displayed core is uniquely determined by the data.
A few questions, answered
Is this FAST-MCD?
It exhaustively checks a bounded small subset family and reports a raw optimum, rather than using the FAST-MCD heuristic.
Why differ from sklearn covariance_?
That attribute can include consistency correction and reweighting. Compare raw_covariance_ and the selected raw support first.
Are large robust distances p values?
No. They are distances under selected raw scatter without automatic post-selection calibration.
Why reject a zero determinant?
The selected covariance is singular and cannot support the advertised inverse-based distances.