Difficulty: Intermediate Prerequisites: STAT 211 concepts (sample mean, sample variance, unbiased estimators, normal distribution, hypothesis testing basics).
Source: Lecture Notes, Chapter 2 (Part A) | Principles of Statistics II, Texas A&M University
Tags: one-way ANOVA, analysis of variance, F-test, between-group variance, within-group variance, SST, SSTr, SSE, MSTr, MSE, ANOVA table, factor, levels, treatments, group means
ANOVA is one of the core tools in STAT 212, and it extends hypothesis testing from comparing two means (which you did in STAT 211) to comparing three or more means at once. The central question is: "Do these groups have the same population mean, or does at least one differ?" Despite the name "analysis of variance," the method is fundamentally about comparing means; variance is the mechanism it uses to decide whether the observed differences in means are large enough to be statistically meaningful. You will see ANOVA again when you reach two-way designs and regression, so the logic here is foundational.
One-way ANOVA tests whether the population means of k groups are all equal by comparing how much the group means vary from each other (between-group variance) to how much individual observations vary within each group (within-group variance). If the between-group variance is large relative to the within-group variance, we reject the null hypothesis and conclude that at least one group mean differs.
Factor
A categorical independent variable that defines the groups being compared. It is the thing that makes the groups different from one another. In simple terms, the factor is whatever you are testing the effect of (e.g. textbook used, fertiliser type, company).
Levels (or treatments)
The specific values or categories a factor can take. Each level corresponds to one group in the experiment. Think of it as: if the factor is "fertiliser," the levels might be Brand A, Brand B, Brand C, and Brand D.
Response variable
The quantitative outcome being measured for each subject (e.g. test score, crop yield, component lifetime). In simple terms, this is the number you record for each observation.
Between-group variance (SSTr)
The variation in the data that is due to differences between the group means. Measured by the treatment sum of squares. Think of it as: how spread out the group averages are from the overall average.
Within-group variance (SSE)
The variation in the data that is due to differences among individual observations inside the same group. Measured by the error sum of squares. Think of it as: the natural scatter of data points around their own group's average.
Grand mean
The overall mean of all N observations across every group, weighted by group size. Denoted X-bar.
ANOVA table
A structured summary showing the source of variation, degrees of freedom, sums of squares, mean squares, and the F-statistic, all in one place.
F-statistic
The ratio MSTr / MSE. It compares between-group variance to within-group variance. A large F suggests the group means are not all equal.
ANOVA analyses the results of experiments where data are collected under two or more conditions (groups).
The simplest version, one-way ANOVA, involves a single factor with k levels.
Each level of the factor defines one group.
Examples of factors and their levels:
Three classes taught with different textbooks (factor = textbook, k = 3).
Four fertilisers applied to corn plots (factor = fertiliser, k = 4).
Three companies producing the same component (factor = company, k = 3).
When factor levels are categories with no natural ordering, use ANOVA.
When factor levels are numerical and can be treated as a continuous variable, the same data could be analysed with regression instead.
Example: drug dose levels of 50 mg, 100 mg, 200 mg, and 400 mg can be treated as four categories (ANOVA) or as a continuous predictor (regression).
For observation j in group i:
X_ij = mu_i + epsilon_ij, where j = 1, ..., n_i and i = 1, ..., k
mu_i is the population mean for group i.
epsilon_ij ~ N(0, sigma^2) independently for all i and j.
This is equivalent to saying the i-th group is a random sample from N(mu_i, sigma^2), and all k samples are independent.
Independence: observations are independent within and across groups.
Normality: the data in each group follow a normal distribution.
Homogeneity of variance (homoscedasticity): all k groups share the same population variance sigma^2. This can be checked using Levene's test.
Null hypothesis: H_0: mu_1 = mu_2 = ... = mu_k (all population means are equal).
Alternative hypothesis: H_a: at least two of the mu_i are different.
Note: the alternative does not say all means differ. It only requires that at least one pair is unequal.
Group sample mean: X-bar_i = (1 / n_i) * sum of X_ij for j = 1 to n_i. This estimates mu_i.
Grand mean: X-bar = (1 / N) sum over all groups and observations = (1 / N) sum of n_i * X-bar_i, where N = n_1 + n_2 + ... + n_k.
Total sum of squares (SST): measures all the variability in the data, regardless of source.
SST = sum over i=1 to k, sum over j=1 to n_i of (X_ij - X-bar)^2
Treatment sum of squares (SSTr): the explained variation, due to differences between group means. Also called "sum of squares for treatments."
SSTr = sum over i=1 to k of n_i * (X-bar_i - X-bar)^2
Error sum of squares (SSE): the unexplained variation, i.e. scatter within each group.
SSE = sum over i=1 to k, sum over j=1 to n_i of (X_ij - X-bar_i)^2
Key identity (partition of total variability):
SST = SSTr + SSE
MSTr = SSTr / (k - 1)
MSE = SSE / (N - k)
F = MSTr / MSE
Source of Variation | Degrees of Freedom | Sum of Squares | Mean Square | F |
|---|---|---|---|---|
Treatments (between) | k - 1 | SSTr | MSTr | MSTr / MSE |
Error (within) | N - k | SSE | MSE | |
Total | N - 1 | SST |
Reject H_0 at significance level alpha when:
F >= F_(k-1, N-k; alpha)
The p-value is P(F_(k-1, N-k) > F_obs), where F_obs is the observed F-statistic.
In pharmaceutical trials, one-way ANOVA compares whether different drug doses produce different average responses (e.g. cholesterol reduction).
In agriculture, it compares whether different fertilisers, seed varieties, or irrigation methods produce different average crop yields.
"A significant F-test means all group means differ." It does not. It only tells you that at least one pair of means is different. You need a follow-up procedure (e.g. Tukey's) to identify which pairs.
"ANOVA compares variances as the goal." Despite the name, the goal is to compare means. Variance is the tool used to make that comparison.
"You can conclude that F is significant whenever F > 1." An F slightly above 1 is expected by chance. You must compare F to the critical value from the F-distribution with the correct degrees of freedom.
"Equal sample sizes are required." One-way ANOVA works with unequal group sizes (n_i can differ across groups), though balanced designs are preferred for robustness.
You will be asked to identify the factor, the levels, and the response variable in a word problem. Practise this on examples.
Know the three assumptions by name and what each means.
Be comfortable reading and interpreting a completed ANOVA table: extracting F, degrees of freedom, and relating them to conclusions.
Understand the partition SST = SSTr + SSE conceptually: total variability splits into explained (between groups) and unexplained (within groups).
The p-value from the F-test is always a right-tail probability from the F-distribution.
1. True or False: The alternative hypothesis in one-way ANOVA states that all group means are different from each other.
A: False. It states that at least two means are different.
2. Fill in the blank: SST = ______ + SSE.
A: SSTr.
3. True or False: MSE is a weighted average of the sample variances of the k groups.
A: True.
4. Fill in the blank: The F-statistic is the ratio of ______ to ______.
A: MSTr to MSE (between-group mean square to within-group mean square).
5. True or False: If the F-statistic is less than or equal to 1, you would never reject H_0.
A: True. All F critical values exceed 1, so F <= 1 can never lead to rejection.
Q: In an experiment, 150 students are split into three classes of 50, each using a different textbook but the same instructor. The same final exam is given. What is the factor, what are the levels, and what is the response variable?
A: The factor is the textbook. The levels are the three different textbooks (one per class). The response variable is the student's exam score.
Q: An ANOVA table shows SSTr = 509.12, SSE = 563.13, with k = 4 groups and N = 40 total observations. Calculate MSTr, MSE, and the F-statistic.
A: MSTr = 509.12 / (4 - 1) = 169.707. MSE = 563.13 / (40 - 4) = 15.643. F = 169.707 / 15.643 = 10.849.
Q: The p-value for the F-statistic above is 3.199 x 10^-5. At alpha = 0.05, what do you conclude?
A: Since the p-value is far smaller than 0.05, we reject H_0 and conclude that the mean amount of iron is not the same across all four formations.
Q: After a one-way ANOVA produces a significant result, a researcher announces that all four group means are significantly different from one another. Is this claim justified?
A: No. The ANOVA F-test only tells us that at least one pair of means differs. To determine which specific pairs differ, a multiple comparisons procedure (such as Tukey's HSD) is required.
Q: What are the three assumptions of one-way ANOVA?
A: Independence of observations, normality of data within each group, and homogeneity of variance (equal population variances across groups).
One-way ANOVA generalises the two-sample t-test. When k = 2, the F-statistic equals t^2 and the two tests give identical p-values.
The sum-of-squares decomposition (SST = SSTr + SSE) mirrors the decomposition in simple linear regression (SST = SSR + SSE), because ANOVA can be viewed as regression on indicator variables.
After ANOVA, multiple comparisons procedures (covered in Part 2 of these notes) address which means differ, connecting to the broader topic of controlling error rates in simultaneous inference.
one-way ANOVA, single-factor ANOVA, analysis of variance, F-test, F-statistic, F-distribution, between-group variation, within-group variation, treatment sum of squares, error sum of squares, total sum of squares, SSTr, SSE, SST, MSTr, MSE, ANOVA table, grand mean, group mean, sample mean, factor, levels, treatments, homoscedasticity, homogeneity of variance, Levene's test, normality assumption, independence assumption, STAT 212, principles of statistics II, comparing means, hypothesis test for multiple groups