🔒 Please log in to use tool features (fill sample / analyze / AI interpretation / export document)
HomeQuality ToolsDiscriminant Analysis (LDA) Calculator
Discriminant Analysis (LDA) CalculatorFree online tool · works on PC and mobile
Use it now →

Discriminant Analysis (LDA): Classify Samples and Identify Key Variables

What is Discriminant Analysis?

Discriminant analysis uses samples with known class labels, the training set, to build a rule that assigns new samples to the most likely class. Linear discriminant analysis (LDA) assumes equal covariance matrices across classes and constructs discriminant functions that maximize between-group spread relative to within-group spread, giving linear decision boundaries; quadratic discriminant analysis (QDA) relaxes the equal-covariance assumption. It is commonly used for product grading, fault classification and supplier tier judgment.

When to Use It

Use discriminant analysis when you have labeled historical samples and want to classify new observations or identify which measured variables best separate the groups. It suits product classification, defect and failure type classification, and quality-based supplier grading. The LDA assumptions of multivariate normality and equal covariance should be checked first; when variables are far from normal, consider transforms or methods with looser assumptions such as logistic regression or decision trees.

How to Use It (Step by Step)

Prepare data with one column of class labels and several continuous discriminant variables. The tool checks the LDA prerequisites, then runs LDA or QDA with your choice of prior probabilities and outputs the discriminant functions, variable contributions, confusion matrix, cross-validated accuracy and a discriminant score plot. Use the cross-validated accuracy rather than the resubstitution accuracy when judging real predictive power.

Key Formulas / Example

LDA maximizes the ratio of between-group to within-group variance; for k classes it extracts up to k - 1 discriminant functions, each explaining a portion of the total variance ordered by eigenvalue. Classification assigns a sample to the class with the highest posterior probability computed from the discriminant scores and priors. The confusion matrix diagonal shows per-class accuracy, and a large gap between resubstitution and cross-validated accuracy signals overfitting.

Open Discriminant Analysis (LDA) Calculator → Calculate online in your browser · free registration · PC and mobile
MULTIVARIATE Discussions · Latest
No discussions yet — be the first to ask a question in the community.
Frequently Asked Questions
What is the difference between LDA and logistic regression?
LDA is a generative method assuming normal variables with equal covariance and outputs a linear boundary; logistic regression is a discriminative method with looser distribution assumptions. In two-class problems they often give similar results.
What if the variables are not normal?
Transform them (logarithm, Box-Cox) toward normality, or switch to methods with looser assumptions such as logistic regression, KNN or decision trees.
What if class sample sizes are very unbalanced?
Set priors according to actual proportions or upweight the minority class. With heavy imbalance, cross-validated accuracy can be misleading, so use stratified sampling in evaluation.
Can discriminant analysis handle categorical variables?
LDA requires numeric variables; convert categorical variables to dummy variables first, or use classification methods oriented to categorical data.