Great - I have everything needed for a thorough explanation. Here it is:
ANOVA Test - Everything You Need Before Your Lecture
1. What is ANOVA?
ANOVA stands for Analysis of Variance. It is a statistical test used to compare the means of three or more groups to decide whether at least one group mean is significantly different from the others.
Why not just use multiple t-tests?
If you have 3 groups (A, B, C) and want to compare all pairs, you'd need 3 t-tests (A vs B, A vs C, B vs C). Each test has a 5% chance of a false positive (Type I error). Running many tests multiplies this error rate. ANOVA tests all groups simultaneously in one test, keeping the error rate controlled.
2. When Do You Use ANOVA?
Use ANOVA when you have:
- One categorical independent variable (with 3+ groups/levels)
- One continuous dependent variable
- You want to know: "Do these group means differ significantly?"
Examples:
- Does mean blood pressure differ across 3 drug treatments?
- Do 4 different fertilizers produce different crop yields?
- Do students taught by 3 different methods score differently on exams?
3. The Core Idea - Variance Partitioning
ANOVA works by splitting the total variability in the data into two parts:
Total Variance = Between-Group Variance + Within-Group Variance
(SST) (SSB) (SSW)
| Variance Component | What it means |
|---|
| Between-group (SSB) | How much group means differ from the grand mean - variability due to the treatment/grouping |
| Within-group (SSW) | How much individual values vary inside each group - natural random variability |
The key question: Is the between-group variance much larger than the within-group variance? If yes, the groups are genuinely different.
4. The F-Statistic
The test statistic in ANOVA is the F-ratio:
Between-group variance (SSB / df_between) MSB
F = ───────────────────────── = ──────────────── = ────
Within-group variance (SSW / df_within) MSW
- MS = Mean Square (Sum of Squares divided by its degrees of freedom)
- A large F means between-group variation dominates - the groups likely differ
- A small F (near 1) means variation between groups is similar to random noise - no real difference
5. Step-by-Step Calculation (By Hand)
Example Setup
Three exam prep programs (A, B, C), each used by 4 students. Scores:
| Group A | Group B | Group C |
|---|
| 85 | 90 | 70 |
| 80 | 85 | 75 |
| 78 | 92 | 68 |
| 83 | 88 | 72 |
| Mean = 81.5 | Mean = 88.75 | Mean = 71.25 |
Grand mean = (81.5 + 88.75 + 71.25) / 3 = 80.5 (or calculated from all 12 scores)
Step 1: Calculate SSB (Between-Group Sum of Squares)
SSB measures how far each group mean is from the grand mean, weighted by group size:
SSB = Σ nᵢ × (x̄ᵢ - x̄_grand)²
SSB = 4×(81.5 - 80.5)² + 4×(88.75 - 80.5)² + 4×(71.25 - 80.5)²
= 4×(1)² + 4×(8.25)² + 4×(-9.25)²
= 4×1 + 4×68.0625 + 4×85.5625
= 4 + 272.25 + 342.25
= 618.5
Step 2: Calculate SSW (Within-Group Sum of Squares)
SSW measures how far each individual score is from its own group mean:
SSW = Σ(x - x̄_group)² [for every observation in every group]
Group A: (85-81.5)²+(80-81.5)²+(78-81.5)²+(83-81.5)² = 12.25+2.25+12.25+2.25 = 29
Group B: (90-88.75)²+(85-88.75)²+(92-88.75)²+(88-88.75)² = 1.5625+14.0625+10.5625+0.5625 = 26.75
Group C: (70-71.25)²+(75-71.25)²+(68-71.25)²+(72-71.25)² = 1.5625+14.0625+10.5625+0.5625 = 26.75
SSW = 29 + 26.75 + 26.75 = 82.5
Step 3: Calculate SST (Total Sum of Squares)
SST = SSB + SSW = 618.5 + 82.5 = 701
(You can verify this by computing Σ(x - x̄_grand)² for all 12 scores.)
Step 4: Degrees of Freedom (df)
| Source | Formula | Value (our example) |
|---|
| Between groups (df_B) | k - 1 (k = number of groups) | 3 - 1 = 2 |
| Within groups (df_W) | N - k (N = total observations) | 12 - 3 = 9 |
| Total (df_T) | N - 1 | 12 - 1 = 11 |
Step 5: Calculate Mean Squares (MS)
MSB = SSB / df_B = 618.5 / 2 = 309.25
MSW = SSW / df_W = 82.5 / 9 = 9.17
Step 6: Calculate the F-Ratio
F = MSB / MSW = 309.25 / 9.17 ≈ 33.7
Step 7: Compare to Critical F-Value
- Look up the F critical value in an F-distribution table at α = 0.05, with df_B = 2 and df_W = 9
- F critical (2, 9) at α=0.05 ≈ 4.26
- Our F = 33.7 >> 4.26
Conclusion: Reject the null hypothesis. At least one group mean is significantly different.
6. The ANOVA Table (Standard Format)
Every ANOVA result is presented in this table:
| Source | SS | df | MS | F | p-value |
|---|
| Between Groups | 618.5 | 2 | 309.25 | 33.7 | < 0.001 |
| Within Groups (Error) | 82.5 | 9 | 9.17 | | |
| Total | 701 | 11 | | | |
7. Hypotheses
- H₀ (Null): All group means are equal: μ₁ = μ₂ = μ₃
- H₁ (Alternative): At least one group mean is different
Important: ANOVA only tells you that a difference exists - not which groups differ. For that, you need a post-hoc test.
8. Assumptions of ANOVA
You must check these before running ANOVA:
| Assumption | What it means | How to check |
|---|
| Normality | Each group's data is normally distributed | Shapiro-Wilk test, Q-Q plot |
| Homogeneity of variance | All groups have similar variances | Levene's test, Bartlett's test |
| Independence | Observations are independent of each other | Study design check |
| Random sampling | Data collected randomly | Study design check |
9. Post-Hoc Tests (After a Significant ANOVA)
A significant ANOVA says "at least one group differs" - you then run a post-hoc test to find which pairs differ:
| Post-hoc Test | Best used when |
|---|
| Tukey's HSD | Most common; equal group sizes |
| Bonferroni | Conservative; any group sizes |
| Scheffé | Complex comparisons |
| Games-Howell | When variances are unequal |
Example reporting: "A Tukey post-hoc test revealed Groups B and C differed significantly (p < 0.01)."
10. Types of ANOVA
| Type | When to use |
|---|
| One-Way ANOVA | One independent variable (most common; likely what your lecture covers) |
| Two-Way ANOVA | Two independent variables; can also detect interaction effects |
| Repeated Measures ANOVA | Same subjects measured multiple times |
| MANOVA | Multiple dependent variables |
11. Key Terms to Know for Your Lecture
| Term | Meaning |
|---|
| Grand mean | Mean of all observations regardless of group |
| SS (Sum of Squares) | Sum of squared deviations |
| MS (Mean Square) | SS ÷ df; estimates variance |
| F-ratio | MSB ÷ MSW; the test statistic |
| df | Degrees of freedom |
| p-value | Probability of observing the F-ratio if H₀ is true |
| α (alpha) | Significance threshold, typically 0.05 |
| Post-hoc test | Follow-up test to identify which specific groups differ |
12. Quick Decision Rule
F > F_critical (OR p-value < 0.05)
↓
Reject H₀ → At least one group mean differs
↓
Run post-hoc test → Find WHICH groups differ
Summary in 3 Sentences
ANOVA compares the means of 3+ groups by asking: "Is the variability between groups larger than the variability within groups?" It produces an F-statistic - the ratio of between-group to within-group variance - which is compared to a critical value to get a p-value. If p < 0.05, you reject the null hypothesis and use a post-hoc test to find which specific groups are different.
Good luck at your lecture tomorrow! The worked example above (steps 1-7) is the kind of calculation you are very likely to see done in class.