STAT 101
M06 · L03
Module 6 · Lesson 3

ANOVA

Comparing two means is easy. Comparing three or more at once — without inflating your error rate — requires Analysis of Variance. One elegant F-test to rule them all.

01 / 12
STAT 101
M06 · L03
Why not just run t-tests?

The Multiple Testing Trap

4 groups → pairs
6 tests
False positive risk
≈ 26%

Running 6 t-tests at α = 0.05 each raises the familywise error to 1 − 0.95⁶ ≈ 26%. ANOVA keeps it at 5% with one test.

02 / 12
STAT 101
M06 · L03
Splitting up variance

Partitioning SS

Total = Between + Within
SS_T = SS_B + SS_W

SSB is the signal (group means differ from grand mean). SSW is the noise (observations scatter within each group).

03 / 12
STAT 101
M06 · L03
Signal-to-Noise ratio

The F-Statistic

F-Ratio
F = \dfrac{MS_B}{MS_W} = \dfrac{SS_B/(k-1)}{SS_W/(N-k)}

Under H₀, F ≈ 1. Under H₁ (some means differ), MSB grows but MSW stays put → F > 1. Reject H₀ when F exceeds the critical value F*(k−1, N−k).

04 / 12
STAT 101
M06 · L03
Organizing the calculation

The ANOVA Table

  • Between: SSB, df = k−1, MSB = SSB/(k−1)
  • Within: SSW, df = N−k, MSW = SSW/(N−k)
  • Total: SSₜ, df = N−1
  • F = MSB / MSW with p-value from F(k−1, N−k)
05 / 12
STAT 101
M06 · L03
Before you trust results

ANOVA Assumptions

  • Normality within each group (QQ plot, Shapiro-Wilk)
  • Equal variances across groups (Levene’s test; max s ≤ 2× min s)
  • Independence of observations within and across groups
Fallbacks
Non-normal → Kruskal-Wallis
Unequal variances → Welch’s ANOVA
06 / 12
STAT 101
M06 · L03
After a significant F-test

Post-Hoc Tests

Tukey HSD
HSD = q^* \sqrt{\dfrac{MS_W}{n}}

Tukey’s HSD: best for all pairwise comparisons, equal n. Bonferroni: use adjusted α = 0.05/m for any pre-planned set of m comparisons.

07 / 12
STAT 101
M06 · L03
Two factors at once

Two-Way ANOVA

SS Decomposition
SS_T = SS_A + SS_B + SS_{AB} + SS_E

Three simultaneous F-tests: main effect A, main effect B, and interaction AB. Each uses MSE (residual) as the denominator.

08 / 12
STAT 101
M06 · L03
The most important output

Interaction Effects

  • Effect of A depends on which level of B you’re in
  • Visualize: non-parallel lines in an interaction plot
  • Crossing lines = strong interaction (can reverse direction)
  • When significant, do not interpret main effects alone
09 / 12
STAT 101
M06 · L03
When normality fails

Kruskal-Wallis

H-Statistic
H = \dfrac{12}{N(N+1)} \sum_{i=1}^{k} \dfrac{R_i^2}{n_i} - 3(N+1)

Rank all N observations jointly. H ∼ χ²(k−1) under H₀. No normality assumption. Post-hoc: Dunn’s test with Bonferroni.

10 / 12
STAT 101
Knowledge Check

Check what stuck

Four questions from this lesson. Answer to see why — the explanation appears whether you were right or wrong. Nothing is scored or saved.

Question 1 of 0
Score 0/0

11 / 12
STAT 101
Summary
Recap

What you learned

  • ANOVA compares k ≥ 3 means with one F-test, controlling familywise error
  • F = MSB/MSW — between-group signal over within-group noise
  • Assumptions: normality, equal variances, independence
  • Post-hoc: Tukey’s HSD or Bonferroni to find which pairs differ
  • Two-way ANOVA adds interaction — check it before main effects
  • Kruskal-Wallis: rank-based alternative when normality fails
12 / 12