ANOVA

Also known as: Analysis of variance

On this page 7

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.

SourceSum of squaresDegrees of freedomMean squareF
Between groupsSSBk minus 1SSB divided by (k minus 1)MSB divided by MSW
Within groups (error)SSWN minus kSSW divided by (N minus k)Not applicable
TotalSSTN minus 1Not reportedNot applicable
Structure of a one-way ANOVA table

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.

DesignStructureTypical question
One-way ANOVAOne factor, independent groupsDo three fertilizers give different yields
Two-way ANOVATwo factors, with interaction termDo dose and sex jointly affect response
Repeated-measures ANOVASame subjects across conditionsDoes reaction time change over four sessions
Mixed ANOVABetween and within factors combinedDo two therapies differ over time
ANCOVAANOVA plus continuous covariateDo teaching methods differ after adjusting for prior scores
MANOVASeveral dependent variables at onceDo diets differ on weight and cholesterol
Common ANOVA designs and when they apply

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.

AssumptionHow to checkRemedy when violated
Independence of observationsStudy design reviewUse repeated-measures or mixed models
Normality of residualsQ-Q plot, Shapiro-Wilk testTransform data or use Kruskal-Wallis test
Equal variances (homoscedasticity)Levene test, residual plotsUse Welch ANOVA
Sphericity (repeated measures)Mauchly testApply Greenhouse-Geisser correction
ANOVA assumptions, checks and remedies

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 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.

MethodGroups comparedOutcome typeKey difference from ANOVA
t-testExactly twoContinuousWith two groups, F equals t squared
ANOVATwo or moreContinuousReference method
Kruskal-Wallis testTwo or moreRanked or ordinalNonparametric, compares rank distributions
Chi-squared testTwo or moreCategorical countsTests proportions, not means
Linear regressionAny predictorsContinuousSame model in a general form
ANOVA and neighboring methods

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.