Biostatistics • Comparing Multiple Groups

One-Way ANOVA

A powerful method for testing whether three or more group means differ significantly using variance decomposition.

A scatter plot connecting biological data with a DNA strand and health signal.
Inside this lesson 10 sections 5 questions 12 figures

SECTION 1

Historical Context & Motivation

In the early twentieth century, researchers frequently needed to compare outcomes across more than two experimental groups — whether evaluating the effects of different fertilizers on crop yield or assessing multiple drug dosages on patient recovery. The standard tool at the time, the t-test, could only compare two groups at a time. Running multiple pairwise t-tests inflated the probability of a Type I error — the chance of incorrectly rejecting a true null hypothesis. If you performed ten separate t-tests at α = 0.05, the probability of at least one false positive climbed to roughly 40%, rendering conclusions unreliable. What the field needed was a single omnibus test capable of evaluating all groups simultaneously while controlling the overall error rate.

1908 • Student's t-Test

William Sealy Gosset, publishing under the pseudonym "Student," introduced the t-test for comparing two sample means — a breakthrough, but limited to pairwise comparisons.

1918 • Fisher's Variance Components

Ronald A. Fisher published foundational work on the decomposition of variance in genetic studies, laying the conceptual groundwork for analysis of variance.

1925 • ANOVA Formalized

Fisher formally introduced the Analysis of Variance (ANOVA) framework in "Statistical Methods for Research Workers," establishing the F-test as its cornerstone statistic.

1935 • The Design of Experiments

Fisher published his influential text linking ANOVA to experimental design principles such as randomization, replication, and blocking — ideas that remain central to biostatistics today.

1950s+ • Post-Hoc Methods & Extensions

Tukey, Scheffé, Bonferroni, and others developed multiple comparison procedures to identify which specific group means differed after a significant ANOVA result, completing the analytical workflow.

The central question that ANOVA addresses remains as relevant now as it was in Fisher's era: Can the observed differences among several group means be attributed to a genuine treatment effect, or are they simply the result of random sampling variability? One-Way ANOVA provides an elegant, unified answer by partitioning the total variability in the data into components that can be compared using a single F-statistic.

SECTION 2

Core Principles & Definitions

One-Way ANOVA examines the effect of a single categorical independent variable (the factor) on a continuous dependent variable. The factor has k levels (groups), and the test evaluates whether at least one group mean differs significantly from the others. At its heart, ANOVA is not about comparing means directly — it is about comparing variances. If the variance between group means is substantially larger than the variance within groups, then the grouping variable likely has a real effect.

1

Variance Decomposition

Total variability (SST) is partitioned into two additive components: variation between groups (SSB) and variation within groups (SSW). This decomposition is the algebraic foundation of ANOVA.
2

The F-Ratio

The test statistic is the ratio of between-group mean square (MSB) to within-group mean square (MSW). Under H₀, F follows an F-distribution with (k − 1) and (N − k) degrees of freedom.
3

Omnibus Null Hypothesis

H₀: μ₁ = μ₂ = … = μₖ. The null states that all population means are equal. Rejection means at least one mean differs, but does not specify which one.
4

Assumptions

ANOVA requires (1) independence of observations, (2) normality of residuals within each group, and (3) homogeneity of variances (homoscedasticity) across groups.
5

Post-Hoc Testing

When the omnibus F-test is significant, follow-up pairwise comparisons (e.g., Tukey HSD, Bonferroni) identify which specific group means differ while controlling the familywise error rate.
✦

KEY TAKEAWAY

Think of ANOVA like a noise-versus-signal detector. Imagine you are in a crowded lecture hall and several study groups are discussing different topics. The "between-group" variance is how differently the groups' average speaking volumes compare (the signal), while the "within-group" variance is the natural variation in volume among individuals within each group (the noise). ANOVA asks: is the signal loud enough, relative to the noise, to conclude that the groups are genuinely different — or could all the variation you observe be random chatter?

SECTION 3

Visual Explanation — Variance Decomposition

The following diagram illustrates how One-Way ANOVA partitions the total variability in a dataset. Three treatment groups are shown, each with individual observations scattered around their respective group means. The grand mean is the overall average of all observations. The vertical distances between group means and the grand mean represent between-group variation (SSB), while the distances from individual observations to their group mean represent within-group variation (SSW).

Variance Decomposition in One-Way ANOVAResponse Variable (Y)Treatment GroupsGrand Mean (X̄)Group 1x̄₁SSBGroup 2x̄₂SSBGroup 3x̄₃SSBGrand MeanGroup 1Group 2Group 3
Each colored horizontal line marks a group mean (x̄ᵢ). The dashed amber line represents the grand mean. Dashed vertical segments between group means and the grand mean illustrate between-group variation (SSB), while the spread of individual points around each group mean represents within-group variation (SSW).

Observe that Group 1 has a mean well above the grand mean, Group 2 sits near it, and Group 3 falls below. The larger the vertical distances between group means and the grand mean relative to the scatter within each group, the larger the F-statistic becomes. If all three group means were nearly identical, the between-group variation would be negligible and the F-ratio would hover near 1.0, offering no evidence against the null hypothesis.

SECTION 4

Mathematical Framework

The mathematical structure of One-Way ANOVA begins with an additive model for each observation and proceeds through variance decomposition to the construction of the F-statistic. Let Yᵢⱼ denote the j-th observation in group i, where i = 1, …, k and j = 1, …, nᵢ. The total number of observations is N = Σnᵢ.

ANOVA MODEL

Yij=μ+αi+εijYᵢⱼ = μ + αᵢ + εᵢⱼ

Where μ = overall population mean, αᵢ = effect of group i (deviation of group mean from μ), and εᵢⱼ ∼ N(0, σ²) are independent error terms. Under H₀, all αᵢ = 0.

TOTAL SUM OF SQUARES (SST)

SST=ΣiΣj(Yij−Yˉ..)2SST = Σᵢ Σⱼ (Yᵢⱼ − Ȳ..)²

SST measures the total variability of all observations around the grand mean Ȳ.. (the mean of all N observations). Degrees of freedom: N − 1.

BETWEEN-GROUP SUM OF SQUARES (SSB)

SSB=Σini(Yˉi.−Yˉ..)2SSB = Σᵢ nᵢ (Ȳᵢ. − Ȳ..)²

SSB captures variability due to differences among group means. Each squared deviation is weighted by the group sample size nᵢ. Degrees of freedom: k − 1.

WITHIN-GROUP SUM OF SQUARES (SSW)

SSW=ΣiΣj(Yij−Yˉi.)2SSW = Σᵢ Σⱼ (Yᵢⱼ − Ȳᵢ.)²

SSW captures variability within each group — the residual noise unaccounted for by group membership. Degrees of freedom: N − k. Note that SST = SSB + SSW.

F-STATISTIC

F=MSB/MSW=(SSB/(k−1))/(SSW/(N−k))F = MSB / MSW = (SSB / (k − 1)) / (SSW / (N − k))

MSB (Mean Square Between) and MSW (Mean Square Within) are variance estimates obtained by dividing each sum of squares by its degrees of freedom. Under H₀, F follows an F-distribution with df₁ = k − 1 and df₂ = N − k.

ℹ

Why Variances, Not Means?

The name "Analysis of Variance" can be puzzling since the test is used to compare means. The key insight is that if the group means truly differ, the between-group variance estimate (MSB) will systematically overestimate σ², while the within-group estimate (MSW) remains unbiased. The F-ratio exploits this discrepancy: a large F signals that MSB is inflated beyond what random error alone would predict.

SECTION 5

Assumptions & The F-Distribution

The validity of the One-Way ANOVA test depends on three key assumptions. Violations of these assumptions can affect the Type I error rate and power of the test. Understanding these assumptions — and how to assess them — is essential for responsible application in biostatistical research.

AssumptionDescriptionHow to Check
IndependenceObservations within and across groups are independent. No subject contributes to more than one group, and values within a group do not influence each other.Ensured by study design: random sampling, random assignment to groups, no repeated measures on the same subjects.
NormalityThe residuals (εᵢⱼ) within each group follow a normal distribution. Equivalently, Yᵢⱼ is normally distributed within each group.Shapiro-Wilk test, Q-Q plots of residuals. ANOVA is robust to mild departures with moderate-to-large sample sizes (n ≥ 20 per group).
HomoscedasticityAll groups share the same population variance: σ₁² = σ₂² = … = σₖ². This ensures MSW is a valid pooled estimate of σ².Levene's test, Bartlett's test. Rule of thumb: largest group variance should not exceed 4× the smallest. If violated, use Welch's ANOVA.

The three assumptions required for valid One-Way ANOVA inference.

F-Distribution and the Rejection RegionProbability DensityF valueF_critRejection Region (α)Fail to Reject H₀F_obs = 1.0(Expected under H₀)01234+F-distribution (df₁ = 2, df₂ = 12)F under H₀ ≈ 1Rejection region
The F-distribution with df₁ = 2 and df₂ = 12 is right-skewed. Under H₀, the expected F-value is approximately 1.0 (green dashed line). The rejection region lies in the right tail beyond F_crit. When the observed F exceeds this critical value, we reject H₀.

Because the F-distribution is right-skewed and bounded below by zero, the ANOVA test is always one-tailed. A very small F-value (close to 0) suggests the group means are implausibly similar — possibly indicating restricted sampling — while a very large F-value suggests the between-group variation far exceeds the within-group noise. We only reject H₀ when F falls in the upper tail beyond the critical value determined by the chosen significance level α and the degrees of freedom.

SECTION 6

Worked Example — Drug Dosage Study

A clinical researcher investigates whether three dosages of an anti-hypertensive drug produce different mean reductions in systolic blood pressure (mmHg). Fifteen patients are randomly assigned to three groups (n = 5 per group): Low Dose, Medium Dose, and High Dose. The observed reductions are shown below.

Low DoseMedium DoseHigh Dose
4812
61014
5711
3915
71113

Blood pressure reductions (mmHg) for 15 patients across three dosage groups.

One-Way ANOVA: Drug Dosage Study

  1. 1

    Step 1 — Compute Group Means and Grand Mean

    Ȳ₁ = (4 + 6 + 5 + 3 + 7) / 5 = 25 / 5 = 5.0 mmHg. Ȳ₂ = (8 + 10 + 7 + 9 + 11) / 5 = 45 / 5 = 9.0 mmHg. Ȳ₃ = (12 + 14 + 11 + 15 + 13) / 5 = 65 / 5 = 13.0 mmHg. The grand mean is Ȳ.. = (25 + 45 + 65) / 15 = 135 / 15 = 9.0 mmHg.
    Ȳ₁ = 5.0, Ȳ₂ = 9.0, Ȳ₃ = 13.0, Ȳ.. = 9.0
  2. 2

    Step 2 — Compute SSB (Between-Group Sum of Squares)

    SSB = Σ nᵢ(Ȳᵢ − Ȳ..)². Group 1: 5 × (5.0 − 9.0)² = 5 × 16 = 80. Group 2: 5 × (9.0 − 9.0)² = 5 × 0 = 0. Group 3: 5 × (13.0 − 9.0)² = 5 × 16 = 80. SSB = 80 + 0 + 80 = 160.
    SSB = 160
  3. 3

    Step 3 — Compute SSW (Within-Group Sum of Squares)

    For Group 1: (4−5)² + (6−5)² + (5−5)² + (3−5)² + (7−5)² = 1 + 1 + 0 + 4 + 4 = 10. For Group 2: (8−9)² + (10−9)² + (7−9)² + (9−9)² + (11−9)² = 1 + 1 + 4 + 0 + 4 = 10. For Group 3: (12−13)² + (14−13)² + (11−13)² + (15−13)² + (13−13)² = 1 + 1 + 4 + 4 + 0 = 10. SSW = 10 + 10 + 10 = 30.
    SSW = 30
  4. 4

    Step 4 — Compute Mean Squares and F-Statistic

    Degrees of freedom: df_B = k − 1 = 3 − 1 = 2, df_W = N − k = 15 − 3 = 12. MSB = SSB / df_B = 160 / 2 = 80. MSW = SSW / df_W = 30 / 12 = 2.5. F = MSB / MSW = 80 / 2.5 = 32.0.
    F(2, 12) = 32.0
  5. 5

    Step 5 — Compare to Critical Value and Conclude

    At α = 0.05, the critical value F₀.₀₅(2, 12) ≈ 3.89. Since our observed F = 32.0 far exceeds 3.89, we reject H₀. The corresponding p-value is approximately 0.00001, providing very strong evidence that the three dosage groups do not all have the same mean blood pressure reduction. A post-hoc test (e.g., Tukey HSD) would reveal which specific pairs differ.
    Reject H₀ — at least one dosage group mean differs significantly (p < 0.001).

The ANOVA table below summarizes the computation. Notice how SST = SSB + SSW = 160 + 30 = 190, confirming the additive decomposition.

SourceSSdfMSF
Between160280.032.0
Within30122.5—
Total19014——

Complete ANOVA summary table for the drug dosage study.

SECTION 7

Strengths, Limitations & Alternatives

One-Way ANOVA is an indispensable tool in the biostatistician's toolkit, but it is not without constraints. Understanding when to use it — and when to reach for an alternative — is as important as understanding the mechanics of the test itself.

StrengthsLimitations
Controls familywise Type I error rate when comparing multiple groups simultaneously, unlike repeated t-tests.The omnibus test only indicates that at least one mean differs — it does not identify which pair(s) differ. Post-hoc tests are required.
Relatively robust to moderate violations of normality, especially with balanced designs and n ≥ 20 per group.Assumes homogeneity of variances. Unequal variances (especially with unbalanced groups) inflate the false positive rate.
Computationally simple and widely implemented in all major statistical software packages (R, SPSS, SAS, Python).Can only handle one factor. For studies with two or more factors, Two-Way or factorial ANOVA is needed.
Provides a clear framework for variance decomposition, yielding interpretable effect size measures such as η² (eta-squared).Requires independent observations. Repeated measures on the same subjects violate this assumption and require RM-ANOVA.

Strengths and limitations of One-Way ANOVA.

⚠

WHEN TO USE ALTERNATIVES

If the assumption of equal variances is violated, consider Welch's ANOVA, which does not pool variances. If the normality assumption is severely violated and sample sizes are small, the Kruskal-Wallis H test provides a nonparametric alternative that compares rank distributions rather than means. Think of these alternatives as different lenses for examining the same data — each lens is optimized for different conditions, and selecting the right one ensures your conclusions remain valid.

SECTION 8

Connection to Advanced Methods

One-Way ANOVA occupies a foundational position within the broader statistical landscape. Recognizing how it connects to more advanced methods deepens your understanding and prepares you for complex research designs encountered in graduate-level biostatistics and epidemiology.

FeatureOne-Way ANOVAAdvanced Extension
Number of factorsSingle factor with k levelsTwo-Way / Factorial ANOVA handles two or more factors and their interactions
Repeated observationsIndependent observations onlyRepeated Measures ANOVA accounts for within-subject correlation across time points
CovariatesNo continuous covariatesANCOVA incorporates one or more continuous covariates to reduce error variance
Outcome typeContinuous dependent variableGeneralized linear models extend to binary, count, or ordinal outcomes
Regression linkEquivalent to regression with k − 1 dummy variablesThe General Linear Model (GLM) unifies ANOVA and regression into a single framework

How One-Way ANOVA connects to more advanced statistical methods.

A particularly elegant connection is that One-Way ANOVA is algebraically identical to a linear regression with k − 1 indicator (dummy) variables. The regression F-test for overall model significance produces the exact same F-statistic and p-value as the ANOVA F-test. This means that every ANOVA can be re-expressed as a regression problem, and the reverse is also true when the predictors are categorical. Understanding this equivalence is a gateway to the General Linear Model, which forms the backbone of modern applied statistics.

💡

Effect Size: η² (Eta-Squared)

Beyond statistical significance, reporting effect size is essential. η² = SSB / SST represents the proportion of total variance explained by the grouping factor. In our worked example, η² = 160 / 190 ≈ 0.842, meaning that drug dosage accounts for approximately 84% of the variability in blood pressure reduction — a very large effect. Note that η² tends to overestimate the population effect; partial η² or ω² (omega-squared) provide less biased alternatives.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

A researcher compares the mean cholesterol levels across four different diet types. She runs a One-Way ANOVA and obtains F(3, 36) = 0.85, p = 0.48. Interpret this result in context. Why is it important that she used ANOVA instead of performing six separate t-tests?
Show answer
The F-statistic of 0.85 with a p-value of 0.48 indicates that there is no statistically significant difference among the four diet groups' mean cholesterol levels at any conventional significance level (e.g., α = 0.05). We fail to reject H₀: μ₁ = μ₂ = μ₃ = μ₄. The observed between-group variance is actually slightly less than the within-group variance, as F < 1.0, which is consistent with sampling variability alone. If she had performed six pairwise t-tests (C(4,2) = 6 comparisons), the probability of at least one Type I error would have risen to approximately 1 − (0.95)⁶ ≈ 0.26, making spurious significant findings likely. ANOVA maintains the familywise error rate at α = 0.05 for a single omnibus test.

Question 2: BASIC CALCULATION

Three groups of n = 4 subjects each have group means Ȳ₁ = 10, Ȳ₂ = 14, Ȳ₃ = 18. The grand mean is 14. If SSW = 36, compute SSB, MSB, MSW, and the F-statistic.
Show answer
SSB = Σ nᵢ(Ȳᵢ − Ȳ..)². SSB = 4(10 − 14)² + 4(14 − 14)² + 4(18 − 14)² = 4(16) + 4(0) + 4(16) = 64 + 0 + 64 = 128. Degrees of freedom: df_B = k − 1 = 2, df_W = N − k = 12 − 3 = 9. MSB = 128 / 2 = 64. MSW = 36 / 9 = 4. F = MSB / MSW = 64 / 4 = 16.0. With F(2, 9) = 16.0, we compare to F₀.₀₅(2, 9) ≈ 4.26. Since 16.0 >> 4.26, we reject H₀ and conclude that not all group means are equal.

Question 3: INTERMEDIATE

An epidemiologist tests whether mean recovery time (days) differs among three treatment protocols. The ANOVA table shows SSB = 200, SST = 500, with k = 3 groups and N = 30 total patients. (a) Find SSW, MSB, MSW, and F. (b) Compute η² and interpret it. (c) At α = 0.01, is the result significant? (F₀.₀₁(2, 27) ≈ 5.49)
Show answer
(a) SSW = SST − SSB = 500 − 200 = 300. df_B = 3 − 1 = 2, df_W = 30 − 3 = 27. MSB = 200 / 2 = 100. MSW = 300 / 27 ≈ 11.11. F = 100 / 11.11 ≈ 9.00. (b) η² = SSB / SST = 200 / 500 = 0.40. This means 40% of the total variability in recovery time is explained by the treatment protocol — a large effect by Cohen's conventions (small ≈ 0.01, medium ≈ 0.06, large ≈ 0.14). (c) Since F = 9.00 > F₀.₀₁(2, 27) ≈ 5.49, the result is statistically significant at α = 0.01. We reject H₀ and conclude that at least one treatment protocol yields a significantly different mean recovery time.

Question 4: APPLIED

A pharmaceutical company tests four formulations of an analgesic on 24 patients (6 per group). The observed group means for pain reduction (0–100 scale) are: Ȳ₁ = 42, Ȳ₂ = 50, Ȳ₃ = 48, Ȳ₄ = 60. The grand mean is 50. SSW = 840. (a) Perform the complete ANOVA. (b) Levene's test yields p = 0.02. What concern does this raise, and what alternative approach might be used? (c) If the ANOVA is significant, which post-hoc test would you recommend and why?
Show answer
(a) SSB = 6(42−50)² + 6(50−50)² + 6(48−50)² + 6(60−50)² = 6(64) + 0 + 6(4) + 6(100) = 384 + 0 + 24 + 600 = 1008. df_B = 3, df_W = 20. MSB = 1008/3 = 336. MSW = 840/20 = 42. F = 336/42 = 8.0. F₀.₀₅(3, 20) ≈ 3.10, so F = 8.0 is significant. (b) Levene's test p = 0.02 < 0.05 indicates that the equal variance assumption is violated. This threatens the validity of the standard ANOVA F-test. Welch's ANOVA, which does not assume homogeneity of variances, should be used instead. Alternatively, the Games-Howell post-hoc procedure handles unequal variances. (c) Given the heteroscedasticity, the Games-Howell test is preferable to Tukey HSD because it does not assume equal variances. If variances were equal, Tukey HSD would be ideal for all pairwise comparisons while controlling the familywise error rate.

Question 5: CRITICAL THINKING

Prove algebraically that when k = 2 (only two groups with equal sample sizes), the ANOVA F-statistic equals the square of the independent-samples t-statistic (i.e., F = t²). Then explain the conceptual implications of this relationship for the broader statistical framework.
Show answer
With k = 2 and n observations per group (N = 2n), the between-group sum of squares is SSB = n(Ȳ₁ − Ȳ..)² + n(Ȳ₂ − Ȳ..)². Since Ȳ.. = (Ȳ₁ + Ȳ₂)/2, we have Ȳ₁ − Ȳ.. = (Ȳ₁ − Ȳ₂)/2 and Ȳ₂ − Ȳ.. = (Ȳ₂ − Ȳ₁)/2. Thus SSB = n[(Ȳ₁ − Ȳ₂)/2]² + n[(Ȳ₂ − Ȳ₁)/2]² = 2n(Ȳ₁ − Ȳ₂)²/4 = n(Ȳ₁ − Ȳ₂)²/2. With df_B = 1, MSB = n(Ȳ₁ − Ȳ₂)²/2. MSW = SSW/(2n − 2) = s²_p (pooled variance). Now F = MSB/MSW = n(Ȳ₁ − Ȳ₂)²/(2s²_p). The t-statistic is t = (Ȳ₁ − Ȳ₂)/√(2s²_p/n), so t² = n(Ȳ₁ − Ȳ₂)²/(2s²_p) = F. This relationship reveals that the t-test is a special case of ANOVA, and ANOVA generalizes the two-sample comparison to k groups. Both F(1, N−2) and t(N−2) are members of the same family of tests derived from the General Linear Model. This unification is a cornerstone of modern statistics: every comparison of group means can be expressed as a variance ratio, whether there are two groups or twenty.

SUMMARY

One-Way ANOVA — Summary

Summary

One-Way ANOVA is an omnibus test that compares the means of three or more independent groups by decomposing the total variability (SST) into between-group variation (SSB) and within-group variation (SSW). The F-statistic (MSB / MSW) is compared against the F-distribution with df₁ = k − 1 and df₂ = N − k. A large F-value indicates that the between-group signal exceeds the within-group noise, leading to rejection of the null hypothesis H₀: μ₁ = μ₂ = … = μₖ.

The test requires independence, normality of residuals, and homogeneity of variances. When the omnibus test is significant, post-hoc comparisons (Tukey HSD, Bonferroni) identify which specific group means differ. Report effect sizes (η²) alongside p-values to convey practical significance. One-Way ANOVA is a special case of the General Linear Model, connecting it to regression, ANCOVA, factorial designs, and repeated measures — making it a gateway to the full spectrum of modern biostatistical analysis.

Varsity Tutors • Biostatistics • One-Way ANOVA