One-Way Analysis of Variance
Compare population means across groups defined by one factor. Split total squared variation into between-group and within-group parts, then compare their mean squares using an F test.
What a learner can do afterwards
- Identify a one-factor numerical-response design and partition the total sum of squares
- Compute and interpret an F ratio and its two degrees of freedom, checking the classical model assumptions
- Explain pair counting, family-wise error and adjusted follow-up comparisons
1 · Read
One-way analysis of variance (ANOVA) compares population means across groups defined by one categorical factor, using a numerical response. The null says all population means are equal; the alternative says at least one pair differs. The classical F test assumes independent observations, normal populations within groups and equal population variances. Check the study design and these assumptions before interpreting the test.
A sum of squares (SS) adds squared deviations. Total SS uses observations' distances from the grand mean, the mean of all observations. Within-group SS uses distances from each observation's own group mean. Between-group SS measures variation among group means, weighted by group size. Total SS = between-group SS + within-group SS. Find a missing component by subtracting the known component from the total.
To calculate between-group SS, subtract the grand mean from each group mean, square each difference, multiply by that group's size, and add. For equal group sizes, the grand mean is also the average of the group means. Equal sample means do not force within-group SS to be zero: observations can still vary around those means.
Let k be the number of groups and N the total number of observations. Between-group degrees of freedom (df) = k - 1; within-group df = N - k. A mean square (MS) is SS divided by its df. Calculate F = MS between / MS within when MS within is positive. Dividing the raw sums of squares skips the required scaling.
F measures MS between relative to MS within. Here F = 9 / 3 = 3, so MS between is three times MS within. Large F values give evidence against equal population means, but chance can also produce large values. Under the null and the model assumptions, the reference curve is an F distribution with numerator df k - 1 and denominator df N - k.
The F distribution is nonnegative and right-skewed. This ANOVA test rejects only in the right tail. At a significance level chosen in advance, reject when F exceeds the matching critical value, or when its right-tail p-value is at most that level. Otherwise, do not reject. A small F does not support rejection, and nonrejection does not prove equal population means.
There are k(k - 1)/2 pairs among k groups. Five groups give 5 x 4 / 2 = 10 pairs. Unadjusted pairwise tests at 5% can raise the chance of at least one false rejection above 5%. That chance is the family-wise error rate. Pairwise tests share data, so their errors need not be independent. One ANOVA tests the joint null at the chosen level; it does not protect later unadjusted tests.
An ANOVA rejection gives evidence that not all population means are equal. It does not identify the differing pairs or show that every pair differs. To compare all pairs, use family-wise error control, such as Tukey's procedure or adjusted pairwise tests. Planned comparisons can also be valid without first rejecting ANOVA when their error control is specified in advance.
Split total SS into between and within parts. Divide each by its df to form F. Check assumptions, use the right-tail decision rule, and control error across follow-up comparisons.
This lesson, its practice questions, worked solutions and flashcards were written for this dataset.
These readings, extra questions, worked solutions and flashcards were written for this dataset.
More to read
What the groups and sums of squares mean
A one-way ANOVA studies a numerical response across groups defined by one categorical factor. A study of drying time for different paint types has paint type as its factor and drying time as its response. The population means are the quantities being compared.
The null hypothesis says those population means are all equal. Its alternative allows at least one differing pair. Neither hypothesis says that every observation in a group must equal its group mean.
The classical F reference model assumes independent observations, normal populations within groups and a common population variance. Repeated measurements on the same person do not meet the independent-observations requirement merely because they have different group labels.
Total SS records squared distances from the grand mean. Within-group SS records squared distances from each observation's own group mean. Between-group SS records group means' squared distances from the grand mean, weighted by group size. The between and within components add to total SS.
For example, equal sample group means can coexist with spread inside each group. That makes between-group SS zero but can leave within-group SS positive.
From sums of squares to a decision
The two sums of squares must be scaled before they are compared. With k groups and N observations, between-group df is k - 1 and within-group df is N - k. Divide each SS by its own df to obtain its mean square. Then divide MS between by MS within to obtain F, provided the denominator is positive.
Suppose four groups contain 24 observations altogether. Between-group SS of 90 has 3 df, giving MS between = 30. Within-group SS of 100 has 20 df, giving MS within = 5. The resulting F is 30 / 5 = 6, not 90 / 100.
Under the equal-means null and the classical assumptions, use an F reference distribution with numerator df 3 and denominator df 20. Both degrees of freedom affect its critical value and p-value.
The test looks for unusually large ratios in the right tail. Its p-value is the probability, under that null model, of an F at least as large as the observed value. Compare it with a significance level chosen before examining the result. Reject at or below that level. Otherwise, do not reject; this does not establish that the population means are equal.
Choosing a comparison family
Comparing every pair among k groups takes k(k - 1)/2 tests. The same groups appear in several comparisons, so these tests share observations. Their errors need not be independent.
For a family of tests, the family-wise error rate is the chance of rejecting at least one true null hypothesis. Setting each unadjusted pairwise test to 5% does not automatically keep that family-wide chance at 5%. It can be higher. An exact rate cannot be obtained by treating shared-data comparisons as independent without justification.
An ANOVA at 5% tests one joint null: all population means are equal. Under its model, the significance level controls false rejection of that joint null. It does not grant error control to later unadjusted pairwise tests.
A rejected ANOVA can lead to questions about individual pairs. Tukey's procedure or appropriately adjusted pairwise tests address that comparison family. Rejection alone does not identify the differing pairs, and some pairs may still have equal population means.
Comparisons planned in advance can also be valid without a preceding ANOVA rejection. Their error control must match the planned family of claims.
2 · Watch
Take it off screen
Where it sits
Where this leads
Jobs that lean on this skill. Follow one to see everything it is built on.
17 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.