ANOVA: Analysis of Variance
Compare means across three or more groups using ANOVA. Learn the F-test, post-hoc analysis, and effect size measures.
On This Page
Why ANOVA?
When comparing means of three or more groups, we use ANOVA (Analysis of Variance) instead of multiple t-tests.
- Do test scores differ among three teaching methods?
- Is there a difference in crop yield across four fertilizers?
- Do customer satisfaction scores vary by store location?
The Logic of ANOVA
ANOVA compares variation between groups to variation within groups.
If group means are truly different:
- Between-group variation will be large (groups are spread apart)
- Within-group variation reflects natural variability
If group means are equal:
- Between-group variation should be similar to within-group variation
The F-statistic measures this ratio:
Hypotheses in One-Way ANOVA
H₀: μ₁ = μ₂ = μ₃ = … = μₖ (all means equal)
H₁: At least one mean is different
ANOVA Table
| Source | SS | df | MS | F |
|---|---|---|---|---|
| Between | SS_B | k - 1 | MS_B = SS_B/(k-1) | F = MS_B/MS_W |
| Within | SS_W | N - k | MS_W = SS_W/(N-k) | |
| Total | SS_T | N - 1 |
Where:
- k = number of groups
- N = total sample size
- SS = Sum of Squares
- MS = Mean Square
Total SS:
Between SS:
Within SS:
Note:
Complete Example
Three fertilizers tested on plant growth (in cm):
| Fertilizer A | Fertilizer B | Fertilizer C |
|---|---|---|
| 20 | 24 | 28 |
| 22 | 26 | 30 |
| 21 | 25 | 29 |
| 23 | 27 | 31 |
| 19 | 23 | 27 |
Group means: A = 21, B = 25, C = 29 Grand mean: (21 + 25 + 29)/3 = 25
Calculate SS_Between:
Calculate SS_Within: Each group has variance = 2.5, so:
ANOVA Table:
| Source | SS | df | MS | F |
|---|---|---|---|---|
| Between | 160 | 2 | 80 | 32 |
| Within | 30 | 12 | 2.5 | |
| Total | 190 | 14 |
F = 80/2.5 = 32
Critical value: F₀.₀₅(2,12) = 3.89
P-value: < 0.0001
Decision: Since F = 32 > 3.89, reject H₀.
Conclusion: There is significant evidence that at least one fertilizer produces different plant growth.
Assumptions of ANOVA
- Independence: Observations are independent within and between groups
- Normality: Each group’s population is normally distributed
- Homogeneity of variances: All groups have equal population variances
If Assumptions Fail
| Violation | Solution |
|---|---|
| Non-normality | Kruskal-Wallis test (non-parametric) |
| Unequal variances | Welch’s ANOVA |
| Both | Kruskal-Wallis test |
Effect Size: Eta-Squared
Proportion of variance explained by group membership
| η² | Interpretation |
|---|---|
| 0.01 | Small |
| 0.06 | Medium |
| 0.14 | Large |
From the fertilizer example:
84% of the variation in plant growth is explained by fertilizer type. This is a very large effect.
Post-Hoc Tests
If ANOVA is significant, which groups differ? Use post-hoc (multiple comparison) tests.
Common Post-Hoc Tests
| Test | When to Use |
|---|---|
| Tukey’s HSD | Equal sample sizes, all pairwise comparisons |
| Bonferroni | Conservative, any comparison |
| Scheffé | Complex contrasts, very conservative |
| Games-Howell | Unequal variances |
| Dunnett | Compare each treatment to control |
Groups i and j differ if:
Where q is from the Studentized Range distribution
From the fertilizer example:
For α = 0.05, k = 3, df = 12: q = 3.77
Critical difference = 3.77 × √(2.5/5) = 3.77 × 0.707 = 2.67
Pairwise differences:
- |A - B| = |21 - 25| = 4 > 2.67 ✓ Significant
- |A - C| = |21 - 29| = 8 > 2.67 ✓ Significant
- |B - C| = |25 - 29| = 4 > 2.67 ✓ Significant
All three fertilizers produce significantly different growth!
Two-Way ANOVA (Preview)
Two-way ANOVA examines:
- Main effect of Factor A
- Main effect of Factor B
- Interaction between A and B
Study how fertilizer type (A, B, C) and watering schedule (daily, weekly) affect plant growth.
Questions answered:
- Is there an effect of fertilizer type?
- Is there an effect of watering schedule?
- Does the effect of fertilizer depend on watering schedule? (interaction)
ANOVA vs Multiple T-Tests
| ANOVA | Multiple T-Tests |
|---|---|
| Controls Type I error rate | Inflates Type I error |
| One test for overall difference | Multiple tests needed |
| Needs post-hoc for specifics | Directly compares pairs |
| More efficient | Less efficient |
Summary
In this lesson, you learned:
- ANOVA compares means of 3+ groups while controlling Type I error
- F-statistic = Between-group variance / Within-group variance
- H₀: All group means are equal; H₁: At least one differs
- Large F leads to rejecting H₀
- Assumptions: Independence, normality, equal variances
- Eta-squared (η²) measures effect size
- Post-hoc tests (Tukey, Bonferroni) identify which groups differ
Practice Problems
1. Four teaching methods were compared on final exam scores:
- Method 1: n=10, mean=75, SD=8
- Method 2: n=10, mean=80, SD=9
- Method 3: n=10, mean=72, SD=7
- Method 4: n=10, mean=85, SD=10
The ANOVA yields F = 4.25. With df = (3, 36) and F-critical = 2.87, what’s the conclusion?
2. An ANOVA has SS_Between = 450 and SS_Total = 1500. a) What is SS_Within? b) Calculate η²
3. If an ANOVA with 5 groups (n=20 each) yields F = 6.2 and is significant, how many post-hoc pairwise comparisons are possible?
4. Why is it inappropriate to use multiple t-tests to compare 5 groups?
Click to see answers
1. F = 4.25 > F-critical = 2.87 Reject H₀. There is significant evidence that at least one teaching method produces different results.
2. a) SS_Within = SS_Total - SS_Between = 1500 - 450 = 1050 b) η² = SS_B/SS_T = 450/1500 = 0.30 (large effect)
3. Number of pairwise comparisons = k(k-1)/2 = 5(4)/2 = 10 comparisons
4. With 5 groups, there would be 10 pairwise t-tests. At α = 0.05 each:
- P(at least one Type I error) = 1 - (0.95)¹⁰ ≈ 0.40
- 40% chance of false positive!
- ANOVA maintains the overall α at 0.05
Next Steps
Continue with advanced analysis:
- Chi-Square Tests - Categorical data analysis
- Correlation - Relationships between variables
- Linear Regression - Predicting outcomes
Was this lesson helpful?
Help us improve by sharing your feedback or spreading the word.