Topic contents

Lesson 1

Why do we need analysis of variance?

Why must we examine both between-group and within-group variability when comparing three population means?

What is variance? Starting with three students' scores

First, review descriptive statistics: three students scored 60, 70, and 80 points, with a mean score of 70 points. How can we describe the spread of these higher and lower scores with a single number?

"Deviation": subtract the mean from each score

StudentScore xDeviation x − 70Squared deviation (x − 70)²
A60-10100
B7000
C80+10100
Total0200

The deviations sum to 0 because positive and negative deviations cancel, so their sum cannot measure spread.

"Square": square each deviation

(−10)² + 0² + (+10)² = 200. This is the sum of squared deviations (SS).

Dividing the sum of squares by the corresponding degrees of freedom gives a variance estimate. Here we calculate the sample variance:

s2=∑i(xi−xˉ)2n−1=2003−1=100s^2=\frac{\sum_i(x_i-\bar x)^2}{n-1}=\frac{200}{3-1}=100
60-1070080+10Mean 70
Each score's deviation from the mean of 70 points
Think about it: if both 60 and 80 were changed to 70 points, how would the sum of squared deviations change? How would the sample variance change?
This helps us understand analysis of variance (ANOVA): a deviation is a difference from the mean, and squaring gives a squared deviation. We will decompose the sum of squared deviations for all scores into between-group and within-group parts, then compare their corresponding mean squares to test whether several population means are equal.

Note: the sum of squares SS is not yet a variance; sample variance requires division by n−1. In the analysis of variance that follows, a mean square MS is a sum of squares divided by its corresponding degrees of freedom.

Teaching methods and within-group variability

Try it

What do differences in mean scores tell us?

Student scores under three teaching methods form three groups of data. Adjust the three group means and within-group variability to see how the gaps between sample means and the spread within groups change.

The three sums of squares in this lesson: SSA (between-group sum of squares) measures variation of group means around the grand mean; SSE (within-group sum of squares) measures variation of individuals around their own group mean; SST (total sum of squares) measures variation of all individuals around the grand mean. SST = SSA + SSE.
If group means differ by 5 points, is the evidence equally strong when scores within each group vary widely and when they are almost identical?
Method A: 65.0Method B: 70.0Method C: 75.0406080100Score (points)Method A: 58.6 pointsMethod A: 62.6 pointsMethod A: 64.4 pointsMethod A: 65.8 pointsMethod A: 67.4 pointsMethod A: 71.2 pointsMethod B: 63.6 pointsMethod B: 67.6 pointsMethod B: 69.4 pointsMethod B: 70.8 pointsMethod B: 72.4 pointsMethod B: 76.2 pointsMethod C: 68.6 pointsMethod C: 72.6 pointsMethod C: 74.4 pointsMethod C: 75.8 pointsMethod C: 77.4 pointsMethod C: 81.2 points
  • Grand mean 70.0
Dots represent student scores; horizontal lines show group sample means; the dashed line shows the grand mean.
F statistic
8.159
Right-tail p-value
0.004001
Numerator and denominator degrees of freedom
2, 15

Why not repeatedly run t-tests on three groups?

A t-test can usually be used to compare the means of two groups. Making three pairwise comparisons, A–B, A–C, and B–C, at a significance level of 5% each creates a multiple-testing problem.

One-way analysis of variance (ANOVA) first answers an overall question: are all three population means equal?
Even after a significant overall F-test, a single p-value cannot tell us which two groups differ; appropriate post hoc comparisons are needed.
Method A: 65.0Method B: 70.0Method C: 75.0406080100Score (points)Method A: 58.6 pointsMethod A: 62.6 pointsMethod A: 64.4 pointsMethod A: 65.8 pointsMethod A: 67.4 pointsMethod A: 71.2 pointsMethod B: 63.6 pointsMethod B: 67.6 pointsMethod B: 69.4 pointsMethod B: 70.8 pointsMethod B: 72.4 pointsMethod B: 76.2 pointsMethod C: 68.6 pointsMethod C: 72.6 pointsMethod C: 74.4 pointsMethod C: 75.8 pointsMethod C: 77.4 pointsMethod C: 81.2 points
  • Grand mean 70.0
Dots represent student scores; horizontal lines show group sample means; the dashed line shows the grand mean.

Three sample means: 65.0, 70.0, 75.0; grand mean: 70.0.

Teaching methods and within-group variability

Try it

Examine between-group differences, then within-group differences

Between-group differences: look at how far apart the three horizontal group-mean lines are. Within-group differences: look at how widely the dots in each group are spread around their own group mean.

Both sources of variation must be considered. The absolute gaps between means alone cannot tell us whether the differences are statistically significant.
Method A: 65.0Method B: 70.0Method C: 75.0406080100Score (points)Method A: 58.6 pointsMethod A: 62.6 pointsMethod A: 64.4 pointsMethod A: 65.8 pointsMethod A: 67.4 pointsMethod A: 71.2 pointsMethod B: 63.6 pointsMethod B: 67.6 pointsMethod B: 69.4 pointsMethod B: 70.8 pointsMethod B: 72.4 pointsMethod B: 76.2 pointsMethod C: 68.6 pointsMethod C: 72.6 pointsMethod C: 74.4 pointsMethod C: 75.8 pointsMethod C: 77.4 pointsMethod C: 81.2 points
  • Grand mean 70.0
Examine both the between-group deviations of group means from the grand mean and the within-group deviations of individual scores from their own group mean.

Three sample means: 65.0, 70.0, 75.0; grand mean: 70.0.

From the research question to decomposing variation in the next lesson

From sums of squares to mean squares: MSA (between-group mean square) = SSA/(k−1); MSE (within-group mean square) = SSE/(N−k); F = MSA/MSE. Here k is the number of groups and N is the total number of observations.
Source of variationSum of squares (SS)Degrees of freedom dfMean square (MS)F
SSA (between groups)300.002150.008.159
SSE (within groups)275.761518.38—
SST (total)575.7617——
F statistic
8.159
Right-tail p-value
0.004001
Numerator and denominator degrees of freedom
2, 15
Why does ANOVA first split "total variation" into "between-group variation" and "within-group variation"? The next lesson examines the sums of squares and degrees of freedom term by term.