Between-group and within-group variation
Understand the core logic of analysis of variance through dots, mean lines, and sums of squares.
Teaching methods and within-group variability
Try it
Why does a point deviate from both its group mean and the grand mean?
The difference between each student's score and the grand mean can be split into two parts:
The first part is the within-group deviation; the second is the deviation of the group mean from the grand mean.
- Grand mean 70.0
Teaching methods and within-group variability
Try it
Sum-of-squares decomposition: SST = SSA + SSE
We use the uppercase notation common in textbooks: SST (total sum of squares), SSA (between-group sum of squares), and SSE (within-group sum of squares). T stands for Total, A denotes the between-group source, and E stands for Error (error or within-group variation).
SSA (between-group sum of squares)
Measures differences of group means from the grand mean; each group's squared deviation is weighted by its sample size.
SSE (within-group sum of squares)
Measures how far each observation lies from its own group mean.
SST (total sum of squares)
Measures the overall spread of all observations relative to the grand mean.
Here nᵢ is the sample size of group i, x̄ᵢ is the sample mean of group i, and x̄ is the grand mean of all sample observations.
- Grand mean 70.0
- SSA (between-group sum of squares)
- 300.0
- SSE (within-group sum of squares)
- 275.8
- SST (total sum of squares)
- 575.8
Substitute term by term: why do the sums of squares decompose exactly?
| Source of variation | Sum of squares (SS) | Degrees of freedom df | Mean square (MS) | F |
|---|---|---|---|---|
| SSA (between-group sum of squares) | 300.00 | 2 | 150.00 | 8.159 |
| SSE (within-group sum of squares) | 275.76 | 15 | 18.38 | — |
| SST (total sum of squares) | 575.76 | 17 | — | — |
Substituting the current values
- SSA = 6 × [(65.00 − 70.00)² + (70.00 − 70.00)² + (75.00 − 70.00)²] = 300.000
- SSE = ΣΣ(xᵢⱼ−group meanᵢ)² = 275.760
- SST = 300.000 + 275.760 = 575.760
- MSA = 300.000 / 2 = 150.000
- MSE = 275.760 / 15 = 18.3840
- F = 150.000 / 18.3840 ≈ 8.159
Substituted values in the formulas are displayed as decimals; calculations always use the original, unrounded data.
Where do the degrees of freedom come from?
There are k=3 groups and N=18 observations in total.
Between-group degrees of freedom: k−1 = 2
Within-group degrees of freedom: N−k = 15
Total degrees of freedom: N−1 = 17
Between-group degrees of freedom + within-group degrees of freedom = total degrees of freedom.
Teaching methods and within-group variability
Try it
Why divide by degrees of freedom?
Sums of squares are affected by degrees of freedom, so we divide each sum of squares by its corresponding degrees of freedom to obtain a mean square: MSA (between-group mean square) and MSE (within-group mean square).
| Source of variation | Sum of squares (SS) | Degrees of freedom df | Mean square (MS) | F |
|---|---|---|---|---|
| SSA (between-group sum of squares) | 300.00 | 2 | 150.00 | 8.159 |
| SSE (within-group sum of squares) | 275.76 | 15 | 18.38 | — |
| SST (total sum of squares) | 575.76 | 17 | — | — |
- F statistic
- 8.159
- Right-tail p-value
- 0.004001
- Numerator and denominator degrees of freedom
- 2, 15