Quant Memo
Core

Quadratic and Regularized Discriminant Analysis

Classifying observations into groups by letting each group have its own covariance shape rather than forcing a shared one — more flexible than linear discriminant analysis, but prone to overfitting unless regularized.

Prerequisites: The Sample Covariance Matrix and Eigenvalue Bias

You want to classify a stock as "likely to be acquired" or "not," using several financial characteristics at once. Linear discriminant analysis (LDA) draws a single straight boundary between the two groups, implicitly assuming both groups' characteristics scatter in the same shape around their centers — same spread, same correlations, just shifted. That assumption is often false: acquisition targets might cluster tightly on some characteristics while non-targets scatter widely, or the correlations between characteristics might differ entirely. Quadratic discriminant analysis (QDA) lets each group have its own covariance shape, drawing a curved boundary that fits this better — but that flexibility must be estimated from data, and with limited data per group, QDA can overfit badly, exactly the problem regularized discriminant analysis manages.

An analogy: fitting a fence around two flocks of birds

Imagine two flocks of birds in a field, and you want to fence them apart. If both flocks scatter in the same oval shape, just centered differently, a straight fence works well — that's LDA. But if one flock scatters in a wide oval and the other in a narrow, tilted oval, a straight fence cuts through both; a curved fence shaped to each flock's actual scatter separates them far better — that's QDA. The catch: drawing that curved fence accurately needs enough observed birds in each flock to see its true shape. With only a handful per flock, the "shape" you estimate is mostly noise, and a curved fence fit to noise looks great on birds you've already seen but fails on new ones.

The mechanics, one symbol at a time

Let μk\mu_k and Σk\Sigma_k be the mean vector and covariance matrix of group kk's characteristics. LDA assumes all groups share one common covariance matrix (Σk=Σ\Sigma_k = \Sigma for every kk), which makes the decision boundary between any two groups linear. QDA drops that assumption, estimating a separate Σk\Sigma_k for each group, which makes the boundary quadratic (curved) — it can bend to fit each group's actual shape. The classification rule for both compares each group's discriminant score; for QDA this is

LDA: shared shape, straight line QDA: different shapes, curved line
LDA fits one straight boundary that works when both groups scatter identically in shape; QDA lets the boundary curve to match each group's own, possibly very different, covariance shape.
δk(x)=12logdet(Σk)12(xμk)Σk1(xμk)+logπk,\delta_k(x) = -\tfrac{1}{2}\log\det(\Sigma_k) - \tfrac{1}{2}(x-\mu_k)^\top \Sigma_k^{-1}(x-\mu_k) + \log \pi_k,

where xx is the observation's characteristic vector, πk\pi_k is the prior probability of group kk, and an observation is assigned to whichever group gives the highest δk(x)\delta_k(x). In plain English: each group "claims" an observation based on how close it is to its own center, measured in its own units of spread and correlation, adjusted for how common the group is and how spread out it tends to be. Because each Σk\Sigma_k has its own full parameter set, QDA needs enough data per group to estimate a separate covariance matrix reliably — with pp characteristics that's p(p+1)/2p(p+1)/2 numbers per group, growing fast.

Regularized discriminant analysis (RDA) blends the two extremes with a tuning parameter α\alpha:

Σ^k(α)=αΣ^k+(1α)Σ^pooled,\widehat{\Sigma}_k(\alpha) = \alpha \widehat{\Sigma}_k + (1-\alpha)\widehat{\Sigma}_{\text{pooled}},

shrinking each group's own noisy covariance estimate toward the shared pooled estimate. In plain English: α=1\alpha=1 recovers pure QDA (fully separate shapes), α=0\alpha=0 recovers pure LDA (one shared shape), and anything in between lets each group deviate from the shared shape only as much as the data can reliably support, with a second parameter often added to further shrink toward a diagonal or identity matrix when even the pooled estimate is noisy.

Worked example 1: QDA overfitting with too little data

Suppose you have only 15 observations for the "acquired" group and 4 characteristics. Estimating a full 4×44\times4 covariance matrix for that group requires estimating 10 distinct numbers (4×5/24\times5/2) from just 15 data points — barely more observations than parameters. The resulting Σ^acquired\widehat{\Sigma}_{\text{acquired}} will fit the 15 training points' quirks almost perfectly (near-zero apparent within-group scatter along some direction, purely by chance), giving QDA a training classification accuracy that looks excellent but a held-out test accuracy that's much worse, because the "shape" it learned was largely sampling noise, not the true group structure.

Worked example 2: RDA recovering stability

Same data, but now using RDA with α=0.3\alpha = 0.3: each group's covariance estimate is a blend of 30% its own noisy 15-observation estimate and 70% the pooled covariance (estimated from all observations across both groups combined, hundreds of points, and therefore far more stable). The resulting decision boundary is only mildly curved rather than wildly bent to fit 15 points' noise, and cross-validation on held-out data shows accuracy much closer to the training accuracy — the regularization traded a small amount of training fit for a large gain in how well the classifier generalizes.

pure QDA (α=1, overfit) RDA (α=0.3, regularized)
With only a handful of points per group, QDA's boundary bends tightly to fit training noise; RDA's shrinkage toward a shared, more stable covariance produces a smoother boundary that transfers better to new data.

What this means in practice

QDA is worth reaching for over LDA whenever there's genuine reason to expect groups to differ in their covariance structure, not just their means — but only if there's enough data per group to estimate that structure reliably, a bar that's easy to miss with small or imbalanced classes, common in finance (few acquisition targets, few defaults, few regime-shift days). Regularized discriminant analysis, with α\alpha chosen by cross-validation, is the practical default whenever group sizes are small or uneven, letting the data itself decide how much separate covariance structure is trustworthy.

QDA lets each class have its own covariance shape, producing a more flexible curved boundary than LDA's shared-shape linear boundary, but that flexibility requires enough per-class data to estimate reliably; regularized discriminant analysis blends class-specific and pooled covariance estimates to get flexibility without overfitting when data is scarce.

Don't default to QDA just because it fits training data better than LDA — with small or imbalanced group sizes, that better training fit is often the covariance matrix memorizing noise, not real group-specific structure, and it will underperform LDA or RDA on new data. Always compare held-out (cross-validated) performance, not training accuracy, before choosing QDA over a regularized or linear alternative.

Related concepts

Practice in interviews

Further reading

  • Friedman, 'Regularized Discriminant Analysis', JASA (1989)
  • Hastie, Tibshirani, Friedman, The Elements of Statistical Learning, ch. 4
ShareTwitterLinkedIn