Linear Discriminant Analysis (LDA — Classification)

Statistics
Introduced by
Ronald A. Fisher
Year
1936
Type
Parametric linear classifier / dimensionality reduction

What does it do?

Linear Discriminant Analysis (LDA) is a parametric supervised classification method that finds linear combinations of continuous predictors that separate two or more predefined groups.

Ronald A. Fisher introduced it in his 1936 paper on taxonomic measurements, and it can serve both as a classifier and as a dimensionality-reduction tool. It is closely related to MANOVA and is often presented as its classification-oriented counterpart.

The intuition behind the method

Imagine projecting a multi-dimensional cloud of data points onto a single line so that the groups clump together as tightly as possible within themselves while spreading as far apart from each other as possible. LDA finds exactly that projection by maximising Fisher's ratio — the between-group variance divided by the within-group variance — and then assigns new observations to the nearest class centroid in that reduced space.

History

Ronald A. Fisher introduced the linear discriminant in his 1936 Annals of Eugenics paper 'The Use of Multiple Measurements in Taxonomic Problems', where he used four measurements of three iris species to separate the groups. He framed the problem as finding the projection that maximises the ratio of between-group to within-group variance.

When to use it

Use LDA when the outcome is a categorical group membership with two or more predefined groups and the predictors are continuous, or when you want discriminant axes for reducing dimensionality before further analysis. LDA's classification rule relies on four assumptions: multivariate normality of the predictors within each class (for example, checked with Mardia's or Henze-Zirkler's test); homogeneity of within-class covariance matrices (checked with Box's M test); independence of observations; and no severe multicollinearity, because the within-class covariance matrix must be inverted. Sample size should be judged against the number of predictors and classes rather than a fixed total: each group should contain substantially more observations than there are predictors, and the total sample must support a stable pooled covariance estimate. Avoid LDA when group covariances clearly differ, where Quadratic Discriminant Analysis (QDA) is the natural alternative, or when group separation is plausibly nonlinear. For binary outcomes with doubtful predictor distributions, logistic regression does not assume multivariate normal predictors and is a common alternative.

Limitations and considerations

  • Sensitive to violations of multivariate normality and equal covariance; QDA or nonparametric methods should be preferred when these fail.
  • Linear decision boundaries may be inadequate for groups with complex, nonlinear separation in the predictor space.
  • Strongly correlated predictors make the within-class covariance matrix ill-conditioned, so its inverse and the discriminant weights become unstable.
  • Covariance estimates become unreliable when the number of predictors approaches or exceeds the number of observations, or when group sizes are small relative to the number of predictors.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Produces discriminant axes that both separate the groups and can be plotted, with the number of axes limited to min(K-1, p).
  • Estimation reduces to a closed-form generalised eigenproblem on the scatter matrices, so no iterative optimisation is required.
  • Under multivariate normality with a common covariance matrix and correctly specified priors, the linear rule is Bayes-optimal for these distributions; with estimated parameters, performance is approximate.
  • Gives posterior class probabilities alongside hard assignments, which allows classification uncertainty to be reported.

Applications

  • Medical diagnosis: classifying patients into disease or healthy groups based on a battery of biomarker measurements.
  • Biology and taxonomy: separating species or subspecies based on morphological measurements, following Fisher's original iris example.
  • Social science research: distinguishing groups (e.g. high vs. low academic achievers) using cognitive and demographic predictors.
  • Marketing: segmenting customers into predefined segments based on attitudinal or behavioural scales.
  • Quality control: detecting defective versus conforming units from multivariate sensor readings.

How it works

How it works

1

The null hypothesis states that all group mean vectors are equal, and the alternative states that at least one differs. This describes the group separation that the discriminant axes capture, but default LDA does not perform this as a test: it reports no test statistic or p-value for it. The axes are estimated from the data under the assumption of a common within-class covariance matrix. For a formal test of equal mean vectors, see MANOVA.

Formula
H_0:\ \boldsymbol{\mu}_1 = \boldsymbol{\mu}_2 = \cdots = \boldsymbol{\mu}_K \quad H_1:\ \text{at least one mean vector differs}
2

LDA estimates the within-class scatter matrix S_W and the between-class scatter matrix S_B from training data. For two groups, the discriminant weight vector is w = S_W^-1 (mu_1 - mu_2), the direction that maximises Fisher's criterion J(w), the ratio of between-class to within-class spread along w. For K classes, the discriminant directions are solutions of the generalised eigenvalue problem S_W^-1 S_B w = lambda w, and up to min(K-1, p) such functions are extracted. The two-group vector is the special case of this general solution.

Formula
\mathbf{w} = \mathbf{S}_W^{-1}(\boldsymbol{\mu}_1 - \boldsymbol{\mu}_2), \quad J(\mathbf{w}) = \frac{\mathbf{w}^\top \mathbf{S}_B\, \mathbf{w}}{\mathbf{w}^\top \mathbf{S}_W\, \mathbf{w}}
3

A new observation is assigned to the class with the highest posterior probability, computed from the class-conditional densities and the class priors using Bayes' rule, with priors set equal or estimated from the data. Under the assumed multivariate normal within-class distributions with a shared covariance matrix, the resulting decision boundaries are linear hyperplanes. Performance is then assessed with a confusion matrix, overall accuracy and cross-validation.

Formula
\hat{y} = \arg\max_{k}\; P(C_k \mid \mathbf{x}) \propto P(\mathbf{x} \mid C_k)\,P(C_k)

Common pitfalls

  • Assuming equal covariances without checking (for example with Box's M test); if variances differ substantially across groups, QDA is the more appropriate choice.
  • Interpreting classification accuracy on the training set without cross-validation, which inflates apparent performance.
  • Including highly correlated predictors without regularisation or prior feature selection, risking numerical instability in the matrix inversion.
  • Reporting only accuracy and ignoring the full confusion matrix, which obscures class-specific misclassification rates.
  • Reading raw discriminant coefficients as measures of variable importance. The coefficients depend on the scale of the predictors, so standardised coefficients or structure (loading) coefficients should be used when interpreting which variables drive the axes.
  • Ignoring the choice of class priors. Posterior probabilities and misclassification rates depend on the priors, and equal priors and sample-proportional priors can produce different assignments, so the choice should be stated when results are reported.

Frequently asked questions

How does LDA differ from logistic regression?

Both produce linear classifiers, but LDA models the distribution of predictors within each class (a generative approach), while logistic regression models the conditional probability of class membership directly (a discriminative approach). When the normality and equal-covariance assumptions are plausible, LDA may give more stable estimates; when they are doubtful, logistic regression is generally the more defensible choice.

What is the difference between LDA for classification and LDA for dimensionality reduction?

They use the same mathematical machinery. In classification mode, LDA assigns observations to groups. In dimensionality reduction mode, LDA projects high-dimensional data onto the discriminant axes (canonical variates) for visualisation or as a preprocessing step before another classifier. Many implementations do both simultaneously.

When should I use QDA instead of LDA?

Use Quadratic Discriminant Analysis when Box's M test indicates that the within-class covariance matrices differ significantly across groups. QDA fits a separate covariance matrix per class, yielding quadratic (curved) decision boundaries. It requires larger sample sizes to estimate those additional parameters reliably.

How do I evaluate classification performance?

Report the full confusion matrix alongside overall accuracy. Use k-fold cross-validation, stating the number of folds used, to estimate generalisation accuracy on unseen data, as training-set accuracy is optimistically biased. For imbalanced classes, report sensitivity, specificity, and the area under the ROC curve per class rather than relying on overall accuracy alone.

Related methods

Sources

  1. Fisher, R.A. (1936). The Use of Multiple Measurements in Taxonomic Problems. Annals of Eugenics, 7(2), 179–188.

    Open DOI reference
  2. Multivariate statistics_ exercises and solutions, p. 309