Topic contents

Lesson 2

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:

xij−xˉ=(xij−xˉi)+(xˉi−xˉ)x_{ij}-\bar x=(x_{ij}-\bar x_i)+(\bar x_i-\bar x)

The first part is the within-group deviation; the second is the deviation of the group mean from the grand mean.

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.
Observe each group's horizontal line and the dashed grand-mean line: understand deviations first, then sums of squares.

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).

SST=SSA+SSESST=SSA+SSE

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.

SSA=∑ini(xˉi−xˉ)2SSA=\sum_i n_i(\bar x_i-\bar x)^2

SSE (within-group sum of squares)

Measures how far each observation lies from its own group mean.

SSE=∑i∑j(xij−xˉi)2SSE=\sum_i\sum_j(x_{ij}-\bar x_i)^2

SST (total sum of squares)

Measures the overall spread of all observations relative to the grand mean.

SST=∑i∑j(xij−xˉ)2=SSA+SSESST=\sum_i\sum_j(x_{ij}-\bar x)^2=SSA+SSE

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.

Variation to highlight
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.
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 variationSum of squares (SS)Degrees of freedom dfMean square (MS)F
SSA (between-group sum of squares)300.002150.008.159
SSE (within-group sum of squares)275.761518.38—
SST (total sum of squares)575.7617——

Substituting the current values

  1. SSA = 6 × [(65.00 − 70.00)² + (70.00 − 70.00)² + (75.00 − 70.00)²] = 300.000
  2. SSE = ΣΣ(xᵢⱼ−group meanᵢ)² = 275.760
  3. SST = 300.000 + 275.760 = 575.760
  4. MSA = 300.000 / 2 = 150.000
  5. MSE = 275.760 / 15 = 18.3840
  6. 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).

MSA=SSAk−1MSA=\frac{SSA}{k-1}
MSE=SSEN−kMSE=\frac{SSE}{N-k}
F=MSAMSE=SSA/(k−1)SSE/(N−k)F=\frac{MSA}{MSE}=\frac{SSA/(k-1)}{SSE/(N-k)}
Here k is the number of groups and N is the total sample size. Under the null hypothesis and classical analysis of variance (ANOVA) conditions, F follows an F distribution with the corresponding degrees of freedom.
Source of variationSum of squares (SS)Degrees of freedom dfMean square (MS)F
SSA (between-group sum of squares)300.002150.008.159
SSE (within-group sum of squares)275.761518.38—
SST (total sum of squares)575.7617——
F statistic
8.159
Right-tail p-value
0.004001
Numerator and denominator degrees of freedom
2, 15
If group means stay unchanged and only within-group variability increases, how does F usually change?

Teaching methods and within-group variability

Centers 65/70/75 · Within-group spread 4