7.9 Analysis of Variance

Key Takeaways

  • ANOVA partitions total sum of squares into between-groups (treatment) and within-groups (error) components.
  • The F statistic is the ratio of mean square treatment to mean square error, and a large F indicates that group means differ.
  • ANOVA controls the family-wise error rate that repeated pairwise t-tests would inflate.
  • A significant F test says that at least one mean differs but not which; post-hoc tests such as Tukey's HSD identify the pairs.
  • ANOVA assumes independence, normality of residuals, and homogeneity of variances, and is most sensitive to violations of independence.
Last updated: August 2026

Why not repeated t-tests

With $k$ groups there are $k(k-1)/2$ pairwise comparisons. For five groups that is ten tests, and at $\alpha = 0.05$ per test the family-wise error rate is $1 - 0.95^{10} = 0.40$. ANOVA answers the question with a single test at the stated $\alpha$.

The partition

SStotal=SStreatment+SSerrorSS_{total} = SS_{treatment} + SS_{error}

SStotal=ij(yijyˉ)2,SStreat=ini(yˉiyˉ)2,SSerror=ij(yijyˉi)2SS_{total} = \sum_{i}\sum_{j}(y_{ij} - \bar{y})^2, \qquad SS_{treat} = \sum_{i} n_i(\bar{y}_i - \bar{y})^2, \qquad SS_{error} = \sum_{i}\sum_{j}(y_{ij} - \bar{y}_i)^2

The logic: if the group means were all equal, the only reason group averages would differ is random error, so between-group variation would be about the same size as within-group variation. If treatment means genuinely differ, between-group variation is inflated.

The ANOVA table

SourceSum of squaresdfMean squareF
Treatment (between)$SS_{treat}$$k - 1$$MS_{treat} = SS_{treat}/(k-1)$$MS_{treat}/MS_{error}$
Error (within)$SS_{error}$$N - k$$MS_{error} = SS_{error}/(N-k)$
Total$SS_{total}$$N - 1$

where $k$ is the number of groups and $N$ the total number of observations. Reject $H_0: \mu_1 = \mu_2 = \cdots = \mu_k$ when $F > F_{\alpha,,k-1,,N-k}$.

Note that $MS_{error}$ is the pooled estimate of the common within-group variance $\sigma^2$, and its square root is the standard deviation used for post-hoc comparisons.

Worked example

Four suppliers, five specimens each, tensile strength in MPa.

SupplierObservations$\bar{y}_i$
A412, 418, 415, 421, 414416.0
B428, 431, 425, 433, 428429.0
C409, 414, 411, 407, 414411.0
D424, 419, 427, 422, 423423.0

Grand mean $\bar{y} = 419.75$, $N = 20$, $k = 4$.

SStreat=5[(416.0419.75)2+(429.0419.75)2+(411.0419.75)2+(423.0419.75)2]SS_{treat} = 5\left[(416.0 - 419.75)^2 + (429.0 - 419.75)^2 + (411.0 - 419.75)^2 + (423.0 - 419.75)^2\right] =5[14.06+85.56+76.56+10.56]=5×186.75=933.75= 5\left[14.06 + 85.56 + 76.56 + 10.56\right] = 5 \times 186.75 = 933.75

Within-group sums of squares are 50.0, 38.0, 38.0, and 34.0, giving $SS_{error} = 160.0$.

SourceSSdfMSF
Supplier933.753311.2531.13
Error160.001610.00
Total1093.7519

$F_{0.05,3,16} = 3.24$, and $31.13 \gg 3.24$, so at least one supplier mean differs. The effect size is

η2=SStreatSStotal=933.751093.75=0.854\eta^2 = \frac{SS_{treat}}{SS_{total}} = \frac{933.75}{1093.75} = 0.854

so supplier accounts for 85.4% of the variation in tensile strength.

After a significant F

A significant $F$ says at least one mean differs; it does not say which. Post-hoc procedures control the family-wise error rate while making the pairwise comparisons:

ProcedureUse
Tukey's HSDAll pairwise comparisons; the standard default
Dunnett's testComparing several treatments against one control only
Fisher's LSDLeast conservative; only defensible after a significant F, and even then criticized
BonferroniSimple and conservative; adjust $\alpha$ to $\alpha/m$ for $m$ comparisons
ScheffeMost conservative; permits arbitrary contrasts decided after seeing the data

Running post-hoc tests without a significant omnibus F reintroduces the error-rate inflation that ANOVA exists to prevent.

Assumptions

AssumptionHow to checkEffect of violation
Independent observationsStudy design; residuals versus run orderSerious; invalidates the test
Residuals normally distributedNormal probability plot of residuals; Anderson-DarlingMild; ANOVA is robust with balanced designs and moderate n
Equal variances across groupsLevene's or Bartlett's test; residuals versus fitsModerate; serious with unequal group sizes

ANOVA is robust to moderate non-normality when the design is balanced, but it is not robust to dependence. Time-ordered data with autocorrelation, or observations clustered within batches, violate the assumption in a way no transformation fixes; the design must change.

Bartlett's test for equal variances is itself very sensitive to non-normality, so Levene's test is preferred in practice. Where variances differ materially, use Welch's ANOVA or transform the response. When normality fails badly, the Kruskal-Wallis test is the non-parametric alternative.

Residual analysis is the practical way to check all three at once: plot residuals against fitted values (equal variance), on a normal probability plot (normality), and against run order (independence).

Beyond one-way

DesignQuestion
One-wayDoes one factor with $k$ levels affect the response?
Two-wayDo two factors affect the response, and do they interact?
Randomized blockDoes the factor matter, after removing a known nuisance source such as batch or day?
ANOVA within DOEWhich main effects and interactions in a factorial design are significant?

The two-way case introduces the interaction term, which tests whether the effect of one factor depends on the level of the other. Interactions are frequently the most important finding in a Six Sigma analysis, because they are invisible to one-factor-at-a-time experimentation. This is the direct link between ANOVA and the Improve phase: the analysis of a factorial experiment is an ANOVA.

Test Your Knowledge

A one-way ANOVA on four suppliers with five specimens each yields SS treatment = 933.75 and SS error = 160.00. What is the F statistic?

A
B
C
D
Test Your Knowledge

A one-way ANOVA across five machines returns p = 0.003. What may be concluded?

A
B
C
D
Test Your Knowledge

Which ANOVA assumption violation is least amenable to correction and most damaging to the validity of the test?

A
B
C
D