ANOVA extends the two-sample -test to compare three or more group means simultaneously. Running multiple -tests would inflate the Type I error rate; ANOVA controls it with a single -test.
The key insight is partitioning total variability: ANOVA asks whether the variability between groups is large relative to the variability within groups. If yes, at least one mean differs.
One-way ANOVA handles one categorical factor; two-way ANOVA handles two factors and can detect interactions between them.
One-way ANOVA
One-way ANOVA tests (all group means are equal) against : at least one pair of means differs. It replaces the multiple -test approach, which would inflate the Type I error rate.
Partitioning variability: . measures how much group means vary around the grand mean. measures variability within each group.
The -statistic: where . , (total observations , groups ). Under , .
Interpretation: a large means the between-group variation is large relative to within-group noise — the group means differ more than chance would predict. Reject if (critical value from -table).
The ANOVA table summarises the decomposition: Source, SS, df, MS, , -value. Each row represents one source of variability.
💡Explain it simply
ANOVA asks: is the spread between the group averages bigger than the typical spread within each group? If you have three fertiliser treatments and the plants' heights are very different across groups but quite consistent within each group, will be large and you'll conclude the fertiliser type matters.
One-way ANOVA computation
- Three groups (, each, ). Group means: , , . Grand mean .
- . .
- Suppose . .
- . .
- . Compare to . Since , fail to reject .
Assumptions of ANOVA
Independence: all observations are independent within and across groups. Violated by repeated measures on the same subjects (use repeated-measures ANOVA instead).
Normality: each group's population is approximately normally distributed. ANOVA is robust to moderate violations when group sizes are equal and . Check with Q-Q plots of residuals.
Homoscedasticity (equal variances): all groups share the same variance . Check with Levene's test or by comparing the largest to smallest sample standard deviation (ratio is a common rule of thumb). Welch's one-way ANOVA does not require equal variances.
If assumptions are seriously violated, consider transforming the data (e.g., log-transform for right-skewed data) or using the Kruskal-Wallis test (the non-parametric alternative to one-way ANOVA).
💡Explain it simply
ANOVA needs the data to be independent (no repeated measures), roughly bell-shaped in each group (normality), and spread about the same in each group (equal variances). It is fairly forgiving of mild violations when group sizes are balanced and roughly similar.
Post-hoc tests and multiple comparisons
A significant -test tells you at least one mean differs — not which pairs. Post-hoc tests identify specific differences while controlling the family-wise error rate (FWER).
Tukey's HSD (Honest Significant Difference): tests all pairwise comparisons and controls the FWER at exactly. It is the most commonly used post-hoc method for balanced designs.
Bonferroni correction: for comparisons, use for each test. Simple and widely applicable, but more conservative (lower power) than Tukey's when is large.
Scheffé's method: allows any contrast (not just pairwise) while controlling FWER. Most conservative but most flexible.
Planned contrasts: if specific comparisons are hypothesised in advance (before seeing data), they can be tested at level without correction. Only pre-specified comparisons qualify.
💡Explain it simply
A significant -test is like knowing 'someone in this class got a very different grade than the others' — but you don't know who. Post-hoc tests then check each pair of groups to find which ones are actually different, while making sure the overall chance of a false alarm stays at .
Two-way ANOVA
Two-way ANOVA has two categorical factors (with levels) and (with levels). It tests three hypotheses: the main effect of , the main effect of , and the interaction.
An interaction means the effect of on the response depends on the level of (and vice versa). When an interaction is significant, interpret main effects cautiously — they may be misleading averages of varying effects.
The total SS is partitioned: . Each has an associated -ratio and -value.
Two-way ANOVA with replication (more than one observation per cell) is needed to estimate and test the interaction. Without replication, you must assume no interaction exists.
Balanced designs (equal cell sizes) simplify computation and interpretation; unbalanced designs require more care with the order of entering terms (Type I vs. Type III sums of squares).
💡Explain it simply
Two-way ANOVA asks three questions at once: Does factor matter? Does factor matter? Does the combination of and matter in a way that's more than just their individual effects? Interactions are the surprising case: factor helps women but hurts men, for example. Main effects alone would miss that.
Common Mistakes to Avoid
- Running multiple pairwise -tests instead of ANOVA. With groups and tests at , FWER .
- Stopping at a significant without running post-hoc tests. You need post-hoc comparisons to identify which groups differ.
- Ignoring a significant interaction and interpreting only main effects. If is significant, main effects can be misleading.
- Violating the homoscedasticity assumption without correction. Use Welch's ANOVA or the Kruskal-Wallis test when variances differ substantially.
- Claiming a non-significant interaction proves the factors are independent. Non-significance only means insufficient evidence for an interaction.