One-Way and Two-Way Analysis of Variance

Lesson 13 of 214 min7 practice questionsFree

Separate the variation into sources

Analysis of variance (ANOVA) compares means by asking how large the differences among group means are relative to ordinary variation within groups. One-way ANOVA studies one factor, such as the printing line that produced a part. The null hypothesis is that all population means for the levels of that factor are equal. The alternative is that at least one differs. The classical F test assumes independent observations, approximately normal errors within groups and a common error variance.

One factor with several groups

For k groups and N observations, let x̄ᵢ be group i's mean, nᵢ its size and x̄ the overall mean. With unequal group sizes, find x̄ from all N observations. Between-group sum of squares is Σ nᵢ(x̄ᵢ − x̄)². Within-group sum of squares adds (x − x̄ᵢ)² for each observation using its own group mean. Add the two sums to obtain the total sum of squares.

SourceDegrees of freedomMean square
Between groupsk − 1Between SS ÷ (k − 1)
Within groupsN − kWithin SS ÷ (N − k)
TotalN − 1

Divide the between-group mean square by the within-group mean square to get F. For [3, 5], [5, 7] and [7, 9], the group means are 4, 6 and 8 and the overall mean is 6. Between SS is 2(4 − 6)² + 2(6 − 6)² + 2(8 − 6)² = 16. Every observation is one unit from its own group mean, so within SS is 6. With 2 and 3 degrees of freedom, the mean squares are 8 and 2. Thus F = 4. Use the upper tail of F with numerator df 2 and denominator df 3 to decide if the evidence meets your chosen significance level. The overall test can detect a difference. Identifying which means differ requires additional comparisons.

Two factors with one observation per cell

Let r be the number of rows and c the number of columns. Each row and column is a level of its own factor. In an additive model with one observation per cell, row SS is c times the sum of the squared deviations of row means from the overall mean. Column SS is r times the corresponding sum for column means. Subtract both from total SS to get residual SS. This model cannot separate an interaction from residual variation. Use it when the additive assumption is justified.

SourceDegrees of freedom
Rowsr − 1
Columnsc − 1
Residual(r − 1)(c − 1)
Totalrc − 1

Suppose a two-by-three layout has first-row values 7, 8, 9 and second-row values 9, 12, 15. The grand mean is 10, the row means are 8 and 12, and the column means are 8, 10 and 12. Total SS is 44. Row SS is 3(4 + 4) = 24 and column SS is 2(4 + 0 + 4) = 16. Residual SS is 44 − 24 − 16 = 4. The residual mean square is 4 ÷ 2 = 2. The row F is (24 ÷ 1) ÷ 2 = 12 and the column F is (16 ÷ 2) ÷ 2 = 4. Each test uses its own numerator degrees of freedom and the same residual denominator.

Repeated observations let you examine interaction

With m independent observations in every cell of a balanced r-by-c layout and m at least 2, use within-cell variation to estimate error. The interaction has (r − 1)(c − 1) degrees of freedom. Residual degrees of freedom are rc(m − 1). A separate interaction test divides interaction mean square by residual mean square. Interaction asks whether the effect of one factor changes with the level of the other. For example, switching to a new setting raises output by 5 on the first line and lowers it by 2 on the second. This sample pattern points to an interaction worth testing.

SSC CGL 2026 syllabus, Paper II

NIST reference for one-factor ANOVA

USDA example of two-way ANOVA in a randomized complete block design, section 615.0704

NIST reference for replicated two-factor ANOVA

Practise this lesson7 questions · 7 marks · +1 a question · every answer explained
Start practice: One-Way and Two-Way ANOVA Practice

Sign in to keep your progress. Sign in