01 / 21

One-Way ANOVA

Learn how to compare three or more group means using the \( F \)-test to determine if observed differences are statistically significant or simply due to chance.

Biostatistics

Why Do We Need ANOVA?

Imagine testing whether three different fertilizers lead to different plant heights. You could run multiple \( t \)-tests (Group 1 vs 2, 1 vs 3, 2 vs 3), but each test has a chance of a Type I error. The more tests you run, the more likely you get a false positive.

Key Terms to Know

Factor
The independent variable (categorical) that defines the groups: e.g., fertilizer type.
Levels
The individual categories within the factor: e.g., Fertilizer A, B, and C (\( k \) levels).
Response
The continuous dependent variable being measured: e.g., plant height in cm.

Visualizing Group Means

ANOVA asks: are these group means far enough apart relative to the spread within each group to conclude a real difference exists?

Group Response Grand Mean A B C

The Hypotheses

\( H_0 \) : Null
All group means are equal: $$ \mu_1 = \mu_2 = \cdots = \mu_k $$ Any observed differences are due to random sampling variability.
\( H_a \) : Alternative
At least one group mean differs: $$ \exists\; i, j \text{ such that } \mu_i \neq \mu_j $$ At least one group has a truly different population mean.

The \( F \)-Statistic

The core of ANOVA is the \( F \)-ratio, which compares two sources of variance:

\( \text{MS}_{\text{Between}} \)
How much the group means vary around the grand mean. Large when group means are far apart.
\( \text{MS}_{\text{Within}} \)
Average variability of observations around their own group mean. Captures random noise.

Partitioning Total Variance

ANOVA decomposes the total sum of squares into two components:

SS Total SS Between SS Within Due to factor (group differences) Due to random error (noise) +

Degrees of Freedom & Mean Squares

To get mean squares, divide each sum of squares by its degrees of freedom (\( df \)):

Source \( df \) SS MS
Between \( k - 1 \) \( \text{SS}_B \) \( \frac{\text{SS}_B}{k-1} \)
Within \( N - k \) \( \text{SS}_W \) \( \frac{\text{SS}_W}{N-k} \)
Total \( N - 1 \) \( \text{SS}_T \) —

\( t \)-test vs ANOVA

Feature \( t \)-test One-Way ANOVA
Groups compared Exactly 2 \( k \ge 2 \) (any number)
Test statistic \( t \) \( F \)
Type I error control Single comparison only Controls \( \alpha \) across all \( k \) groups
Tells which groups differ? Yes (directly) No: needs post-hoc test
Relationship When \( k = 2 \): \( F = t^2 \)

Assumptions of One-Way ANOVA

1
Independence: Observations within and between groups must be independent of each other.
2
Normality: The response variable is approximately normally distributed within each group (or \( n \) is large enough by CLT).
3
Homogeneity of variances: All groups have roughly equal population variances (\( \sigma_1^2 \approx \sigma_2^2 \approx \cdots \approx \sigma_k^2 \)). Check with Levene's test.

The \( F \)-Distribution

Under \( H_0 \), the \( F \)-statistic follows an \( F \)-distribution with \( df_1 = k - 1 \) and \( df_2 = N - k \). It is always right-skewed and non-negative.

F value Density F critical Fail to reject H₀ Reject H₀ 0 1 2 F

How to Perform One-Way ANOVA

1
State hypotheses: \( H_0\!: \mu_1 = \mu_2 = \cdots = \mu_k \) vs \( H_a \): at least one mean differs.
2
Check assumptions: Independence, normality (Shapiro-Wilk), equal variances (Levene's test).
3
Compute sums of squares: Calculate \( \text{SS}_B \), \( \text{SS}_W \), and \( \text{SS}_T \).
4
Calculate mean squares: \( \text{MS}_B = \frac{\text{SS}_B}{k-1} \) and \( \text{MS}_W = \frac{\text{SS}_W}{N-k} \).
5
Compute \( F \): \( F = \text{MS}_B / \text{MS}_W \). Compare to \( F_{\text{critical}} \) or find the \( p \)-value.
6
Decide & conclude: If \( p < \alpha \), reject \( H_0 \). If significant, run post-hoc tests.

Example: Three Diets

A researcher tests whether three diets produce different mean weight loss (kg) after 8 weeks. Five participants per group:

Participant Diet A Diet B Diet C
1475
2586
3364
4697
5253
Mean4.07.05.0

Computing \( F \) Step by Step

1
\( \text{SS}_B \): \( 5(4.0 - 5.333)^2 + 5(7.0 - 5.333)^2 + 5(5.0 - 5.333)^2 \approx 5(1.778) + 5(2.778) + 5(0.111) = \) 23.33
2
\( \text{SS}_W \): Sum of squared deviations within each group: \( 10.0 + 10.0 + 10.0 = \) 30.0
3
Mean Squares: \( \text{MS}_B = \frac{23.33}{3-1} = 11.67 \), \( \text{MS}_W = \frac{30.0}{15-3} = 2.50 \)
4
\( F \)-statistic: \( F = \frac{11.67}{2.50} = \) 4.67

The ANOVA Table

Here is the completed ANOVA table for our diet example:

Source \( df \) SS MS \( F \)
Between 2 23.33 11.67 4.67
Within 12 30.00 2.50 —
Total 14 53.33 — —

Common Mistakes

✕ Multiple \( t \)-tests
Running many pairwise \( t \)-tests instead of ANOVA inflates the Type I error rate far above \( \alpha \).
✕ Claiming which group differs
A significant \( F \) only tells you at least one group is different. You must use post-hoc tests (e.g., Tukey) to identify which.
✕ Ignoring assumptions
Applying ANOVA to data with grossly unequal variances or strong non-normality gives unreliable \( p \)-values.

Question 1 of 5

What does the null hypothesis of a one-way ANOVA state?

Question 2 of 5

A researcher compares 4 treatments with 10 subjects each (\( N = 40 \)). What are the degrees of freedom for \( \text{MS}_{\text{Between}} \) and \( \text{MS}_{\text{Within}} \)?

Question 3 of 5

If \( \text{MS}_{\text{Between}} = 45 \) and \( \text{MS}_{\text{Within}} = 9 \), what is the \( F \)-statistic?

Question 4 of 5

Which of the following is NOT an assumption of one-way ANOVA?

Question 5 of 5

You run a one-way ANOVA and get \( p = 0.003 \) at \( \alpha = 0.05 \). A valid conclusion is: