ANOVA, short for analysis of variance, is a family of statistical methods that tests whether the means of two or more groups differ by comparing the variation between groups with the variation within them. In statistics, it is the standard tool when an experiment or study has three or more groups, where running many pairwise t-tests would inflate the chance of a false positive.
Developed by Ronald Fisher in the 1920s for agricultural field trials, ANOVA now underpins experimental design in medicine, psychology, manufacturing, marketing and A/B/n testing in data analytics. Its central output is the F statistic, a ratio of two variance estimates, and the associated p-value used to judge the null hypothesis that all group means are equal.
How ANOVA partitions variation
ANOVA rests on one identity: the total sum of squares equals the between-group sum of squares plus the within-group sum of squares. The between-group part measures how far each group mean lies from the grand mean; the within-group part measures how far individual observations lie from their own group mean.
Each sum of squares is divided by its degrees of freedom to give a mean square. The F statistic is the between-group mean square divided by the within-group mean square. When the null hypothesis is true, both estimate the same error variance and F stays close to 1; real differences between means inflate the numerator and push F upward.
The standard one-way ANOVA table, shown below for k groups and N observations, organizes these quantities.
| Source | Sum of squares | Degrees of freedom | Mean square | F |
|---|---|---|---|---|
| Between groups | SSB | k minus 1 | SSB divided by (k minus 1) | MSB divided by MSW |
| Within groups (error) | SSW | N minus k | SSW divided by (N minus k) | Not applicable |
| Total | SST | N minus 1 | Not reported | Not applicable |
The p-value comes from the F distribution with k minus 1 and N minus k degrees of freedom. A small p-value, conventionally below 0.05, indicates that at least one group mean differs, but it does not say which one.
Main types of ANOVA
ANOVA designs differ in the number of factors and in whether the same subjects are measured repeatedly. Choosing the correct design matters because it changes how the error term is calculated.
| Design | Structure | Typical question |
|---|---|---|
| One-way ANOVA | One factor, independent groups | Do three fertilizers give different yields |
| Two-way ANOVA | Two factors, with interaction term | Do dose and sex jointly affect response |
| Repeated-measures ANOVA | Same subjects across conditions | Does reaction time change over four sessions |
| Mixed ANOVA | Between and within factors combined | Do two therapies differ over time |
| ANCOVA | ANOVA plus continuous covariate | Do teaching methods differ after adjusting for prior scores |
| MANOVA | Several dependent variables at once | Do diets differ on weight and cholesterol |
In factorial designs, the interaction effect is often the most informative result: it shows that the effect of one factor depends on the level of another. A significant interaction makes main effects hard to interpret on their own.
Assumptions behind the F test
Classical ANOVA relies on three assumptions, and its reliability depends on how badly they are violated. The table lists each assumption, how analysts check it and what to do when it fails.
| Assumption | How to check | Remedy when violated |
|---|---|---|
| Independence of observations | Study design review | Use repeated-measures or mixed models |
| Normality of residuals | Q-Q plot, Shapiro-Wilk test | Transform data or use Kruskal-Wallis test |
| Equal variances (homoscedasticity) | Levene test, residual plots | Use Welch ANOVA |
| Sphericity (repeated measures) | Mauchly test | Apply Greenhouse-Geisser correction |
ANOVA is fairly robust to non-normality when group sizes are equal and moderately large, thanks to the central limit theorem. It is much more sensitive to unequal variances combined with unequal group sizes, which is why many statisticians now recommend Welch ANOVA as the default for independent groups.
ANOVA compared with related tests
ANOVA sits within a broader set of methods for comparing groups, and it is mathematically a special case of linear regression with categorical predictors coded as dummy variables. The comparison below clarifies its position.
| Method | Groups compared | Outcome type | Key difference from ANOVA |
|---|---|---|---|
| t-test | Exactly two | Continuous | With two groups, F equals t squared |
| ANOVA | Two or more | Continuous | Reference method |
| Kruskal-Wallis test | Two or more | Ranked or ordinal | Nonparametric, compares rank distributions |
| Chi-squared test | Two or more | Categorical counts | Tests proportions, not means |
| Linear regression | Any predictors | Continuous | Same model in a general form |
Post hoc tests, effect sizes and common mistakes
A significant omnibus F test only says that not all means are equal. To locate the differences, analysts use post hoc comparisons that control the familywise error rate, such as Tukey HSD for all pairwise comparisons, Dunnett for comparisons against a control and Games-Howell when variances differ.
Statistical significance should be paired with an effect size. Eta squared gives the share of total variance explained by the factor, while partial eta squared and omega squared adjust for other factors or for bias. Rough benchmarks of 0.01, 0.06 and 0.14 for small, medium and large effects are widely quoted but should be read in the context of the field.
- Running many t-tests instead of ANOVA: with five groups, ten unadjusted tests push the familywise error rate toward 40 percent.
- Ignoring the interaction term in two-way designs and reporting misleading main effects.
- Treating repeated measurements as independent, which understates the error and produces false positives.
- Equating a large p-value with no difference: it may simply reflect low statistical power.
In plain words
ANOVA answers a simple question: are several groups really different, or do they only look different by chance? Imagine three classes taking the same exam. Scores vary inside each class, and the class averages also differ a little.
ANOVA compares how much the class averages differ with how much students differ within each class. If the gap between classes is much larger than the normal spread among students, the difference is probably real. The key takeaway: ANOVA tests whether group differences stand out from ordinary noise.
A real-world example
A product analytics team tests three versions of a checkout page on an e-commerce site and records the order value of 1,500 randomly assigned customers, 500 per version. Average order values are 52, 55 and 58 dollars, with similar spreads in each group.
Because Levene’s test suggests mildly unequal variances, the analyst runs a Welch one-way ANOVA. The result is an F statistic of about 9 with a p-value below 0.001, so the team rejects the hypothesis that all three versions perform equally. A Games-Howell post hoc test shows that version C differs significantly from version A, while version B is not clearly separated from either.
The effect size is small, with omega squared near 0.01, so the team weighs the roughly six-dollar gain against development cost. They roll out version C and plan a follow-up test to confirm the effect over a full sales season.