# Robust Covariance (Minimum Covariance Determinant)

> Estimate the mean and covariance from the h most tightly packed points — the subset with the smallest covariance determinant — so outliers cannot inflate the ellipse that is supposed to expose them.

Source: https://www.mlfoundry.in/learn/robust-covariance  
Section: ML Algorithms › Unsupervised · Anomaly Detection  
Level: advanced · 22 min read · updated 2026-10-08

**The Minimum Covariance Determinant (MCD) estimator:** looks for the $h$ out of $n$ points whose sample covariance has the **smallest determinant**, and reports their mean and (rescaled) covariance as the location and scatter of the data. Because it only ever uses the most concentrated half of the points, up to roughly half of the data can be arbitrarily bad without dragging the estimate away.

- **Task:** Robust estimation of location $\mu$ and scatter $\Sigma$; the basis of outlier detection with Mahalanobis distances
- **Input → output:** $n\times p$ data → $\hat\mu_{\text{MCD}}$, $\hat\Sigma_{\text{MCD}}$, and a robust distance $d_i$ for every point
- **Objective:** $\min_{|H|=h}\det\hat\Sigma_H$ — the tightest $h$-point ellipsoid
- **Algorithm:** FAST-MCD: random starts + C-steps (each step never increases the determinant), then consistency correction and reweighting
- **Breakdown point:** up to $\lfloor (n-p+1)/2\rfloor / n\approx 50\%$, versus $1/n$ for the sample mean and covariance
- **Hyperparameter:** $h$ (scikit-learn: `support_fraction` $=h/n$); default $h\approx (n+p+1)/2$
- **Equivariance:** affine equivariant: rescaling, rotating or shifting the features transforms the estimate the same way — no standardization needed
- **Assumes:** the bulk is roughly elliptical (Gaussian-like), $n > 2p$ or so, and the data are not concentrated on a lower-dimensional subspace

## The problem: outliers hide themselves

The standard way to find multivariate outliers is the **Mahalanobis distance**: fit a mean and covariance, then measure how many "standard deviations" each point is from the centre, *in the shape of the data*. Under a Gaussian model the squared distance follows a $\chi^2_p$ distribution, so anything above, say, its 97.5% quantile is suspicious.

$$
d^2(x_i)=(x_i-\hat\mu)^\top\hat\Sigma^{-1}(x_i-\hat\mu)\;\overset{\text{Gaussian}}{\sim}\;\chi^2_p,\qquad \text{flag if } d^2(x_i)>\chi^2_{p,\,0.975}
$$

- $\hat\mu,\ \hat\Sigma$: estimated mean vector and covariance matrix
- $\chi^2_p$: chi-square distribution with $p$ degrees of freedom ($p$ = number of features)
- $\chi^2_{2,\,0.975}$: $=7.38$ for $p=2$ (its CDF is $1-e^{-x/2}$, so the quantile is $-2\ln 0.025$)

The catch is circular: $\hat\mu$ and $\hat\Sigma$ are estimated **from the same data that contains the outliers**. A small group of outliers pulls the mean toward itself and stretches the covariance in its own direction. The ellipse grows to swallow them, their distances shrink, and they stop looking unusual. This is called **masking**. Its mirror image, **swamping**, is when the distorted ellipse pushes perfectly ordinary points outside the cutoff.

> **One outlier is easy, a cluster is not:** A single far point can usually be caught by the classical distance. Masking bites when several outliers sit *together*: each one is shielded by the others, so deleting them one at a time (the largest $d^2$ first) never gets started. The sample covariance has a **breakdown point of $1/n$** — one point placed far enough away can make it arbitrarily wrong.

## The MCD estimator

Rousseeuw's idea (1984): instead of fitting all points, find the subset of $h$ points that is **most tightly concentrated** and fit only those. "Tight" is measured by the determinant of the subset's covariance, which is proportional to the squared volume of its tolerance ellipsoid.

$$
\hat H=\arg\min_{H\subset\{1..n\},\ |H|=h}\ \det\hat\Sigma_H,\qquad \hat\mu_H=\frac1h\sum_{i\in H}x_i,\quad \hat\Sigma_H=\frac1h\sum_{i\in H}(x_i-\hat\mu_H)(x_i-\hat\mu_H)^\top
$$

- $H$: a subset of $h$ point indices (the "support")
- $\det\hat\Sigma_H$: generalized variance of the subset; the ellipsoid $\{x: d^2_H(x)\le c\}$ has volume $\propto\sqrt{\det\hat\Sigma_H}$
- $\hat\mu_H,\ \hat\Sigma_H$: the raw MCD location and scatter: plain mean and covariance of the chosen subset

$$
h=\left\lfloor\frac{n+p+1}{2}\right\rfloor,\qquad \varepsilon^*(h)=\frac{\min(n-h+1,\ h-p)}{n}\ \xrightarrow{\ h\,=\,\lfloor (n+p+1)/2\rfloor\ }\ \frac{\lfloor (n-p+1)/2\rfloor}{n}\approx\frac12
$$

- $h$: subset size; this choice maximizes the breakdown point
- $\varepsilon^*$: finite-sample breakdown point: the smallest fraction of points that, replaced by arbitrary values, can make the estimate useless
- $n-h+1$: contaminating this many points forces at least one into every h-subset
- $h-p$: a subset needs more than p good points to keep a non-degenerate covariance

Why does it resist outliers? As long as fewer than $n-h+1$ points are bad, there exists an $h$-subset made only of good points, and any subset that includes far-away points has a much larger determinant — so the minimizer avoids them. For our example ($n=12$, $p=2$): $h=7$ and $\varepsilon^*=\min(6,5)/12=5/12\approx 42\%$. Five arbitrary outliers can't break it; the sample covariance is broken by one.

Choosing h is a robustness–efficiency dial.

| h | Breakdown point | Efficiency on clean Gaussian data | When |
| --- | --- | --- | --- |
| $\approx (n+p+1)/2$ | ≈ 50% (maximum) | lowest: uses only half the points | contamination unknown, could be large |
| $\approx 0.75\,n$ | ≈ 25% | noticeably better | you know contamination is modest |
| $n$ | $1/n$ (none) | best (it is the classical estimate) | no outliers — then why bother? |

## The C-step: a descent move on subsets

There are $\binom{n}{h}$ subsets — 792 for our toy problem, astronomically many for real data — so exhaustive search is out. The key tool is the **concentration step** (C-step) of Rousseeuw & Van Driessen (1999): given any $h$-subset, compute its mean and covariance, measure every point's distance under that fit, and take the $h$ closest points as the new subset.

$$
H_{k+1}=\big\{\text{the } h \text{ indices with smallest } d_k^2(x_i)\big\},\qquad d_k^2(x)=(x-\hat\mu_k)^\top\hat\Sigma_k^{-1}(x-\hat\mu_k)
$$

- $H_k$: current subset, with mean $\hat\mu_k$ and covariance $\hat\Sigma_k$
- $d_k^2$: squared Mahalanobis distance of every point (all n, not just the subset) under the current fit

> **C-step theorem:** $\det\hat\Sigma_{k+1}\le\det\hat\Sigma_k$, with equality only if $\hat\Sigma_{k+1}=\hat\Sigma_k$. Since there are finitely many subsets, repeated C-steps reach a fixed point in a finite (in practice small) number of steps.

**Proof sketch**

1. **Old points average to $p$.** For any set, $\frac1h\sum_{i\in H_k}d_k^2(x_i)=\operatorname{tr}\big(\hat\Sigma_k^{-1}\hat\Sigma_k\big)=p$. Because $H_{k+1}$ takes the $h$ *smallest* $d_k^2$, $\frac1h\sum_{i\in H_{k+1}}d_k^2(x_i)\le p$.
2. **Re-centring only helps.** The mean $\hat\mu_{k+1}$ minimizes the sum of any quadratic form over $H_{k+1}$, so measuring around $\hat\mu_{k+1}$ instead of $\hat\mu_k$ can only lower it: $\operatorname{tr}\big(\hat\Sigma_k^{-1}\hat\Sigma_{k+1}\big)=\frac1h\sum_{i\in H_{k+1}}(x_i-\hat\mu_{k+1})^\top\hat\Sigma_k^{-1}(x_i-\hat\mu_{k+1})\le p$.
3. **AM–GM on eigenvalues.** Let $\lambda_1..\lambda_p>0$ be the eigenvalues of $\hat\Sigma_k^{-1}\hat\Sigma_{k+1}$. Then $\det\big(\hat\Sigma_k^{-1}\hat\Sigma_{k+1}\big)=\prod\lambda_j\le\big(\tfrac1p\sum\lambda_j\big)^p\le 1$.
4. **Conclude.** $\det\hat\Sigma_{k+1}\le\det\hat\Sigma_k$. Equality needs every $\lambda_j=1$, i.e. $\hat\Sigma_{k+1}=\hat\Sigma_k$.

The C-step is to MCD what the assign/update loop is to k-means: a monotone descent that is guaranteed to stop, but only at a **local** minimum. Where it ends depends on where it starts.

## FAST-MCD

**FAST-MCD (Rousseeuw & Van Driessen, 1999)**

1. **Many cheap starts.** Draw a random $(p+1)$-subset $J$ (the smallest set with a non-singular covariance; enlarge it if its determinant is 0). Fit $\hat\mu_J,\hat\Sigma_J$ and take the $h$ closest points as $H_1$. Small starts matter: a random $h$-subset almost surely contains outliers when contamination is high, but a 3-point start is often clean.
2. **Two C-steps each,** then keep only the ~10 subsets with the lowest determinant.
3. **Iterate the survivors to convergence** and keep the overall winner: the raw MCD $(\hat\mu_{\text{raw}},\hat\Sigma_{\text{raw}})$.
4. **Large n:** split the data into disjoint groups of ~300, run the above inside each group, pool the best candidates on a merged sample of ~1500, then finish on the full data. Cost is roughly linear in $n$.
5. **Correct and reweight** (next section).

> **What scikit-learn actually does:** `MinCovDet` draws 30 random **$h$-point** starts (not $p+1$), runs 2 C-steps on each, keeps the best 10, and iterates those to convergence; above 500 samples it uses the subset-splitting scheme. The default subset is $\lceil (n+p+1)/2\rceil$ — one point larger than Rousseeuw's $\lfloor\cdot\rfloor$ when $n+p+1$ is odd.

## Consistency correction and reweighting

The raw MCD covariance is **too small**. By construction it is computed from the $h$ most central points, so it estimates the covariance of a *truncated* Gaussian. Two fixes follow.

$$
\hat\Sigma_{\text{MCD}}=c\,\hat\Sigma_{\text{raw}},\qquad c=\frac{h/n}{P\!\left(\chi^2_{p+2}\le\chi^2_{p,\,h/n}\right)}\quad\text{or, empirically,}\quad c=\frac{\operatorname{median}_i\,d^2_{\text{raw}}(x_i)}{\chi^2_{p,\,0.5}}
$$

- $c$: consistency factor: makes the estimate unbiased for Σ when the data really are Gaussian
- $\chi^2_{p,\,h/n}$: the $h/n$ quantile of $\chi^2_p$: the squared radius that contains a fraction $h/n$ of a Gaussian
- $\chi^2_{p+2}$: arises because $E[XX^\top\,\mathbf 1\{d^2\le q\}]=P(\chi^2_{p+2}\le q)\,\Sigma$ for $X\sim N(0,\Sigma)$
- $\chi^2_{p,\,0.5}$: median of $\chi^2_p$; $2\ln 2=1.386$ for $p=2$. scikit-learn uses this median rule

The median rule asks: *after rescaling, does the median point have the median distance a Gaussian would give it?* It is robust (the median ignores outliers), adapts to finite samples, and is what scikit-learn uses. The asymptotic formula (Croux & Haesbroeck, 1999) is what R's `robustbase` uses, together with an extra small-sample factor.

$$
w_i=\mathbf 1\!\left\{d^2_{\text{MCD}}(x_i)\le\chi^2_{p,\,0.975}\right\},\qquad \hat\mu_{\text{RW}}=\frac{\sum_i w_i x_i}{\sum_i w_i},\qquad \hat\Sigma_{\text{RW}}=\frac{\sum_i w_i (x_i-\hat\mu_{\text{RW}})(x_i-\hat\mu_{\text{RW}})^\top}{\sum_i w_i}
$$

- $w_i$: hard weight: 1 if the point looks regular under the corrected MCD, 0 if it is flagged
- $\hat\mu_{\text{RW}},\ \hat\Sigma_{\text{RW}}$: reweighted (final) estimates: ordinary mean and covariance of every non-flagged point

**Reweighting** recovers efficiency. The raw MCD threw away $n-h$ points even if they were perfectly good; reweighting brings back every point that the robust fit says is regular, keeping the high breakdown point while using far more data. The final **robust distances** $d^2_{\text{RW}}(x_i)$ are then compared with the same $\chi^2_{p,\,0.975}$ cutoff. (Strictly, the reweighted covariance should also be inflated slightly, since it is fitted to points inside a 97.5% ellipse; scikit-learn skips this, R applies it.)

## Worked example: 12 points, 3 outliers

Nine points rise from lower-left to upper-right (correlation $+0.75$). Three outliers sit together at the lower right. $n=12$, $p=2$, so $h=\lfloor 15/2\rfloor=7$ and the cutoff is $\chi^2_{2,\,0.975}=7.38$.

The data. P10–P12 are the planted outliers.

| Point | x₁ | x₂ | Point | x₁ | x₂ |
| --- | --- | --- | --- | --- | --- |
| P1 | 0.5 | 2 | P7 | 4 | 5 |
| P2 | 2 | 1 | P8 | 4.5 | 4 |
| P3 | 2 | 3 | P9 | 5 | 5 |
| P4 | 2.5 | 2 | **P10** | **8** | **1** |
| P5 | 3 | 4.5 | **P11** | **9** | **2** |
| P6 | 4.5 | 3.5 | **P12** | **9** | **0** |

**Classical fit.** All 12 points give $\hat\mu=(4.50,\,2.75)$ and $\hat\Sigma=\begin{pmatrix}7.33&-1.35\\-1.35&2.56\end{pmatrix}$, $\det=16.96$. Three outliers have flipped the sign of the correlation, from $+0.75$ to $-0.31$. The largest classical $d^2$ is P12's $4.35$, well under $7.38$: **no point is flagged**. P1, an ordinary inlier, has a larger distance ($3.14$) than outlier P10 ($2.20$).

C-steps by hand from start A, J = {P2, P5, P12} (one outlier among the 3 seeds). Each row: subset, its mean and covariance, and the determinant, which never goes up.

| Step | Subset H (7 points) | Outliers in H | μ_H | Σ_H (σ₁₁, σ₁₂, σ₂₂) | det Σ_H |
| --- | --- | --- | --- | --- | --- |
| H₀ (start J) | P2, P5, P12 | 1 | (4.67, 1.83) | (9.56, −3.39, 3.72) | 24.08 |
| H₁ | P2, P3, P4, P6, P8, **P10, P12** | 2 | (4.64, 2.07) | (6.98, −1.80, 1.89) | 9.95 |
| H₂ | P2, P3, P4, P5, P6, P8, **P10** | 1 | (3.79, 2.71) | (3.92, −0.53, 1.70) | 6.40 |
| H₃ | P2, P3, P4, P5, P6, P7, P8 | 0 | (3.21, 3.29) | (1.06, 0.90, 1.70) | 0.99 |
| H₄ | P3, P4, P5, P6, P7, P8, P9 | 0 | (3.64, 3.86) | (1.12, 0.70, 1.05) | **0.691** |
| H₅ | = H₄ → converged |  |  |  | 0.691 |

Check the theorem on step $H_1\to H_2$: under the $H_1$ fit, the seven points chosen for $H_2$ have $\sum d_1^2=13.86\le hp=14$; then $\operatorname{tr}(\hat\Sigma_1^{-1}\hat\Sigma_2)=1.75\le p=2$ and $\det\hat\Sigma_2/\det\hat\Sigma_1=0.64\le(1.75/2)^2=0.77$. The outliers leave one at a time. Once the subset is clean, the ellipse snaps onto the inlier cloud, and the outliers' $d^2$ jump from single digits to 65–104.

Start B, J = {P2, P8, P11}, gets trapped: it converges with two outliers still in the subset.

| Step | Subset H | Outliers in H | μ_H | det Σ_H |
| --- | --- | --- | --- | --- |
| H₀ (start J) | P2, P8, P11 | 1 | (5.17, 2.33) | 12.68 |
| H₁ | P2, P3, P4, P6, P8, **P10, P11** | 2 | (4.64, 2.36) | 8.03 |
| H₂ | P1, P3, P4, P6, P8, **P10, P11** | 2 | (4.43, 2.50) | 7.11 |
| H₃ | = H₂ → converged (local minimum) |  |  | 7.11 |

This is why FAST-MCD uses many starts: $0.691<7.11$, so start A wins. Brute force over all $\binom{12}{7}=792$ subsets confirms $\{P3,\dots,P9\}$ with $\det=0.691$ is the **global** MCD. Its raw covariance is $\begin{pmatrix}1.12&0.70\\0.70&1.05\end{pmatrix}$.

**Correction and reweighting**

1. **Raw distances** under $H_4$: inliers $0.90$–$8.82$ (P1 = 8.82 and P2 = 7.87 are outside the subset and look extreme because the raw ellipse is too small), outliers $67.3,\ 69.4,\ 109.6$.
2. **Consistency factor** (median rule): the median of the 12 raw $d^2$ is $2.87$, so $c=2.87/1.386=2.07$. (The asymptotic formula would give $c=0.583/P(\chi^2_4\le1.75)=2.67$.) Corrected distances: P1 $4.26$, P2 $3.80$; outliers $32.5,\ 33.5,\ 52.9$.
3. **Weights:** the 9 inliers are under $7.38$, the 3 outliers are over it.
4. **Reweighted fit** on the 9 inliers: $\hat\mu=(3.11,\,3.33)$, $\hat\Sigma=\begin{pmatrix}1.99&1.44\\1.44&1.83\end{pmatrix}$, correlation $+0.75$, $\det=1.58$ (the classical one was $16.96$, so the 97.5% ellipse is $\sqrt{16.96/1.58}\approx3.3\times$ smaller in area).

Squared distances, classical vs robust (cutoff 7.38). The classical fit flags nothing; MCD flags exactly the three outliers. Values verified with numpy and sklearn.MinCovDet.

| Point | Classical d² | Robust d² (final) | Flag (robust) |
| --- | --- | --- | --- |
| P1 | 3.14 | 3.81 |  |
| P2 | 2.97 | 3.56 |  |
| P3 | 0.87 | 0.90 |  |
| P4 | 1.09 | 1.19 |  |
| P5 | 1.25 | 1.96 |  |
| P6 | 0.24 | 1.85 |  |
| P7 | 2.05 | 1.72 |  |
| P8 | 0.68 | 1.11 |  |
| P9 | 2.41 | 1.91 |  |
| **P10** | 2.20 | **55.16** | outlier |
| **P11** | 2.76 | **56.59** | outlier |
| **P12** | 4.35 | **89.64** | outlier |

> Figure: Top: FAST-MCD on the worked example. Filled points are the current h-subset; the dashed contour is the old ellipse at the level of the 7th-smallest d² (everything inside it becomes the next subset); the det trace below only ever goes down. Start A sheds the outliers one by one; start B gets stuck with two of them; then the winner is consistency-corrected and reweighted. Bottom: drag the outlier cluster (✛) or single points and raise k. The classical ellipse (dashed) tilts toward the cluster and flags none of it; the MCD ellipse stays on the inliers until the outliers are about half the data (k = 20: contamination 50% exceeds the 47.5% breakdown point), when the cluster takes over the h-subset. The distance–distance plot puts masked points in the upper-left: small classical distance, large robust distance.

## In code

```python
import numpy as np
from scipy.stats import chi2

X = np.array([[0.5, 2], [2, 1], [2, 3], [2.5, 2], [3, 4.5], [4.5, 3.5], [4, 5],
              [4.5, 4], [5, 5], [8, 1], [9, 2], [9, 0]])
n, p = X.shape
h = (n + p + 1) // 2                      # 7

def fit(S):
    mu = X[S].mean(axis=0)
    cov = np.cov(X[S].T, bias=True)       # divide by |S|, like sklearn
    return mu, cov

def mahal2(mu, cov):
    D = X - mu
    return np.einsum("ij,jk,ik->i", D, np.linalg.inv(cov), D)

def c_steps(start, max_iter=100):
    S = np.sort(start)
    mu, cov = fit(S)
    history = [(S, np.linalg.det(cov))]
    for _ in range(max_iter):
        d2 = mahal2(mu, cov)
        S_new = np.sort(np.argsort(d2, kind="stable")[:h])   # h closest points
        if np.array_equal(S_new, S):
            break                                            # fixed point
        S = S_new
        mu, cov = fit(S)
        history.append((S, np.linalg.det(cov)))              # det never increases
    return S, mu, cov, history

def fast_mcd(n_starts=200, seed=0):
    rs = np.random.default_rng(seed)
    best = None
    for _ in range(n_starts):
        J = rs.choice(n, size=p + 1, replace=False)
        if np.linalg.det(fit(J)[1]) < 1e-12:
            continue                                         # collinear start
        S, mu, cov, _ = c_steps(J)
        if best is None or np.linalg.det(cov) < np.linalg.det(best[2]):
            best = (S, mu, cov)
    S, mu, cov = best
    # consistency correction (sklearn's empirical median rule)
    cov = cov * np.median(mahal2(mu, cov)) / chi2.ppf(0.5, p)
    # reweighting at the 97.5% chi-square quantile
    keep = mahal2(mu, cov) <= chi2.ppf(0.975, p)
    mu, cov = fit(np.where(keep)[0])
    return mu, cov, mahal2(mu, cov), S

for S, d in c_steps([1, 4, 11])[3]:       # start A = {P2, P5, P12}
    print(S + 1, round(d, 4))             # dets 24.08, 9.95, 6.40, 0.99, 0.691

mu, cov, d2, S = fast_mcd()
print("raw subset", S + 1)                # [3 4 5 6 7 8 9]
print("mu", mu.round(3))                  # [3.111 3.333]
print("robust d2", d2.round(2))           # ... 55.16 56.59 89.64
```

FAST-MCD from scratch on the worked example: C-steps, random (p+1)-starts, consistency correction, reweighting.

```python
import numpy as np
from scipy.stats import chi2
from sklearn.covariance import EmpiricalCovariance, MinCovDet

X = np.array([[0.5, 2], [2, 1], [2, 3], [2.5, 2], [3, 4.5], [4.5, 3.5], [4, 5],
              [4.5, 4], [5, 5], [8, 1], [9, 2], [9, 0]])

classical = EmpiricalCovariance().fit(X)
mcd = MinCovDet(support_fraction=7 / 12, random_state=0).fit(X)

print("raw support:", np.where(mcd.raw_support_)[0] + 1)   # [3 4 5 6 7 8 9]
print("raw location:", mcd.raw_location_.round(3))         # [3.643 3.857]  (uncorrected)
print("final location:", mcd.location_.round(3))           # [3.111 3.333]  (reweighted)
print("final covariance:\n", mcd.covariance_.round(3))     # [[1.988 1.435] [1.435 1.833]]

cut = chi2.ppf(0.975, df=X.shape[1])                       # 7.38
d2_classical = classical.mahalanobis(X)                    # squared distances
d2_robust = mcd.mahalanobis(X)                             # == mcd.dist_
print("classical flags:", np.where(d2_classical > cut)[0] + 1)   # []
print("robust flags:   ", np.where(d2_robust > cut)[0] + 1)      # [10 11 12]
```

The same with scikit-learn. support_fraction = 7/12 reproduces h = 7; the default (h = 8 here) gives the same final answer on this data.

> **MinCovDet vs EllipticEnvelope:** `MinCovDet` is the *estimator*: it gives you $\hat\mu$, $\hat\Sigma$ and robust distances, and leaves the decision to you. Elliptic Envelope wraps it into a *detector* with a `contamination` parameter that sets the threshold on those distances. Note that `mahalanobis()` returns **squared** distances.

**Strengths**

- The bulk of the data is roughly elliptical and you suspect contamination you can't describe in advance — MCD tolerates up to ~50% of it.
- Outliers may come in groups (a faulty sensor batch, a fraud ring): the masking that defeats classical distances is exactly what MCD handles.
- You need robust inputs for other methods: robust PCA, robust regression diagnostics, robust correlation matrices.
- Features are on different scales or correlated: MCD is affine equivariant, so no standardization is needed and correlations are respected.

**Limitations**

- Dimension is high: you need $h>p$ and in practice $n\gtrsim 5p$; FAST-MCD gets slow and unstable as $p$ grows past a few dozen. Use regularized variants (MRCD) or robust PCA first.
- The regular data are multimodal or curved (clusters, manifolds): a single ellipse is the wrong shape. Use LOF, Isolation Forest or a mixture model.
- Data are discrete or heavily tied: many h-subsets become singular (det = 0) and the minimum is meaningless.
- You need maximum efficiency on clean data: the raw MCD wastes almost half the sample (reweighting recovers much, not all).

- **Multivariate outlier detection:** Robust Mahalanobis distances with a χ² cutoff in quality control, sensor monitoring and fraud screening; the engine of Elliptic Envelope.
- **Finance:** Robust covariance matrices for portfolio risk, less distorted by crash days and data errors.
- **Chemometrics & spectroscopy:** Robust PCA (ROBPCA) and robust calibration, where a few bad samples otherwise dominate the components.
- **Regression diagnostics:** Distance–distance and robust leverage plots separate good leverage points from bad ones (MCD on the predictors).

> **The χ² cutoff assumes Gaussian regular data:** $\chi^2_{p,\,0.975}$ is calibrated for a Gaussian bulk. With heavy tails you will flag many legitimate points; with small $n$ the reweighted MCD is known to over-flag too (it is fitted to points already inside the cutoff). Treat 0.975 as a starting point, inspect a distance–distance plot, and validate the threshold if you have labels.

> **Non-determinism and local minima:** FAST-MCD is randomized and only finds a local minimum of the determinant. Results can change with `random_state`, especially when two candidate structures have similar determinants. Fix the seed, and if it matters, compare several seeds or increase the number of starts.

> **Singular subsets:** If more than $h$ points lie on a hyperplane (duplicated rows, a constant or near-constant feature, linearly dependent columns), the MCD determinant is 0 and scikit-learn warns that the covariance matrix is not full rank. Drop constant or duplicate features, or add a little noise only to break exact ties if that is justified.

**Question:** Why did the classical Mahalanobis distance fail to flag P10–P12 in the worked example?

- A. The χ² cutoff of 7.38 is too strict for two dimensions
- B. The outliers inflated and tilted the covariance they were measured with, so their own distances shrank (masking)
- C. Mahalanobis distance ignores correlation between features
- D. Three points are too few to estimate a covariance

**Answer:** B. The outliers inflated and tilted the covariance they were measured with, so their own distances shrank (masking) — The three outliers pulled the mean toward themselves and stretched Σ in their direction (correlation flipped from +0.75 to −0.31). Measured with that distorted ellipse, their largest d² was only 4.35. MCD fits the ellipse without them, and their d² jumps to 55–90.

**Question:** With n = 12, p = 2 and h = 7, what is the MCD's finite-sample breakdown point?

- A. 1/12
- B. 3/12
- C. 5/12
- D. 7/12

**Answer:** C. 5/12 — $\varepsilon^*=\min(n-h+1,\ h-p)/n=\min(6,5)/12=5/12$. With 6 bad points every 7-subset contains at least one; and a subset needs more than $p=2$ good points so its covariance doesn't collapse.

**Question:** A C-step replaces subset H₁ by the 7 points closest under H₁'s fit. What can you guarantee about H₂?

- A. det Σ_H₂ ≤ det Σ_H₁
- B. H₂ contains no outliers
- C. H₂ is the global MCD subset
- D. H₂ differs from H₁ in exactly one point

**Answer:** A. det Σ_H₂ ≤ det Σ_H₁ — The C-step theorem only promises the determinant does not increase. Start B in the example converged to a local minimum with two outliers still inside, which is why FAST-MCD runs many starts and keeps the lowest determinant.

**Question:** Why is the raw MCD covariance multiplied by a consistency factor c > 1?

- A. To make the estimate invariant to feature scaling
- B. Because it is computed from the h most central points, so it underestimates the spread of the full Gaussian
- C. To raise the breakdown point from 25% to 50%
- D. Because the sample covariance divides by n instead of n − 1

**Answer:** B. Because it is computed from the h most central points, so it underestimates the spread of the full Gaussian — Keeping the tightest half of a Gaussian gives the covariance of a truncated distribution, which is too small. The factor (2.07 here by the median rule) rescales it so that, for clean Gaussian data, it estimates Σ correctly. The n vs n − 1 difference is tiny by comparison.

**Key points**

- Classical mean and covariance have a breakdown point of 1/n: a cluster of outliers inflates the ellipse and masks itself.
- MCD fits the $h\approx(n+p+1)/2$ points with the smallest covariance determinant, giving a breakdown point close to 50%.
- The C-step (refit, then keep the $h$ closest points) never increases $\det\Sigma$. Proof: trace $\le p$, then AM–GM. It converges to a local minimum, so FAST-MCD uses many random starts.
- Raw MCD is too small: rescale it by a consistency factor (median rule: $\operatorname{median}d^2/\chi^2_{p,0.5}$), then reweight with the points under $\chi^2_{p,0.975}$ to regain efficiency.
- Robust distances vs the $\chi^2_p$ cutoff expose outliers the classical distance hides. Compare the two in a distance–distance plot.
- Use it for elliptical, moderate-dimensional data. For high $p$, multimodal or curved data, reach for regularized MCD, robust PCA, or non-parametric detectors.

---

From MLFoundry (https://www.mlfoundry.in). The web page adds interactive figures and diagrams.
