intermediate 30 minutes

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
Advertisement

Why ANOVA?

When comparing means of three or more groups, we use ANOVA (Analysis of Variance) instead of multiple t-tests.

ANOVA Questions
  • 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.

ANOVA Logic

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:

F=Between-group varianceWithin-group variance=MSbetweenMSwithinF = \frac{\text{Between-group variance}}{\text{Within-group variance}} = \frac{MS_{between}}{MS_{within}}


Hypotheses in One-Way ANOVA

ANOVA Hypotheses

H₀: μ₁ = μ₂ = μ₃ = … = μₖ (all means equal)

H₁: At least one mean is different


ANOVA Table

SourceSSdfMSF
BetweenSS_Bk - 1MS_B = SS_B/(k-1)F = MS_B/MS_W
WithinSS_WN - kMS_W = SS_W/(N-k)
TotalSS_TN - 1

Where:

  • k = number of groups
  • N = total sample size
  • SS = Sum of Squares
  • MS = Mean Square
Sum of Squares

Total SS: SST=(xijxˉgrand)2SS_T = \sum(x_{ij} - \bar{x}_{grand})^2

Between SS: SSB=nj(xˉjxˉgrand)2SS_B = \sum n_j(\bar{x}_j - \bar{x}_{grand})^2

Within SS: SSW=(xijxˉj)2SS_W = \sum\sum(x_{ij} - \bar{x}_j)^2

Note: SST=SSB+SSWSS_T = SS_B + SS_W


Complete Example

One-Way ANOVA

Three fertilizers tested on plant growth (in cm):

Fertilizer AFertilizer BFertilizer C
202428
222630
212529
232731
192327

Group means: A = 21, B = 25, C = 29 Grand mean: (21 + 25 + 29)/3 = 25

Calculate SS_Between: SSB=5(2125)2+5(2525)2+5(2925)2SS_B = 5(21-25)^2 + 5(25-25)^2 + 5(29-25)^2 =5(16)+5(0)+5(16)=160= 5(16) + 5(0) + 5(16) = 160

Calculate SS_Within: Each group has variance = 2.5, so: SSW=(51)(2.5)+(51)(2.5)+(51)(2.5)=4(2.5)×3=30SS_W = (5-1)(2.5) + (5-1)(2.5) + (5-1)(2.5) = 4(2.5) \times 3 = 30

ANOVA Table:

SourceSSdfMSF
Between16028032
Within30122.5
Total19014

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

  1. Independence: Observations are independent within and between groups
  2. Normality: Each group’s population is normally distributed
  3. Homogeneity of variances: All groups have equal population variances

If Assumptions Fail

ViolationSolution
Non-normalityKruskal-Wallis test (non-parametric)
Unequal variancesWelch’s ANOVA
BothKruskal-Wallis test

Effect Size: Eta-Squared

Eta-Squared

η2=SSbetweenSStotal\eta^2 = \frac{SS_{between}}{SS_{total}}

Proportion of variance explained by group membership

η²Interpretation
0.01Small
0.06Medium
0.14Large
Effect Size Calculation

From the fertilizer example: η2=160190=0.84\eta^2 = \frac{160}{190} = 0.84

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

TestWhen to Use
Tukey’s HSDEqual sample sizes, all pairwise comparisons
BonferroniConservative, any comparison
SchefféComplex contrasts, very conservative
Games-HowellUnequal variances
DunnettCompare each treatment to control
Tukey's HSD

Groups i and j differ if: xˉixˉj>qα,k,dfW×MSWn|\bar{x}_i - \bar{x}_j| > q_{\alpha,k,df_W} \times \sqrt{\frac{MS_W}{n}}

Where q is from the Studentized Range distribution

Tukey's HSD

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
Two-Way ANOVA Setup

Study how fertilizer type (A, B, C) and watering schedule (daily, weekly) affect plant growth.

Questions answered:

  1. Is there an effect of fertilizer type?
  2. Is there an effect of watering schedule?
  3. Does the effect of fertilizer depend on watering schedule? (interaction)

ANOVA vs Multiple T-Tests

ANOVAMultiple T-Tests
Controls Type I error rateInflates Type I error
One test for overall differenceMultiple tests needed
Needs post-hoc for specificsDirectly compares pairs
More efficientLess 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:

Advertisement

Was this lesson helpful?

Help us improve by sharing your feedback or spreading the word.