Skip to the content

Topics Covered

Concept Assumptions Bartlett’s Test One-way ANOVA Equal n Unequal n Two-way ANOVA F-test ANOVA Table Cochran's Theorem Expected Mean Squares Critical Difference
On this page
  1. 1. Concept of ANOVA
  2. 2. One-way ANOVA
  3. 3. Two-way ANOVA (one observation per cell)
  4. 4. Factorial Experiments (\(2^2\) and \(2^3\))
  5. Worked Problems on Analysis of Variance
  6. Key Take-aways
  7. Extra Practical Problems

1. Concept of ANOVA

DEFINITION

Analysis of Variance (ANOVA), due to R. A. Fisher (1925), is a statistical technique to test whether three or more population means are equal by partitioning the total variation in the data into components attributable to different sources.

The fundamental identity:

\[ \underbrace{\sum (y_{ij} - \bar y)^2}_{\text{Total SS}} = \underbrace{\sum n_i (\bar y_i - \bar y)^2}_{\text{Between (treatment) SS}} + \underbrace{\sum (y_{ij} - \bar y_i)^2}_{\text{Within (error) SS}} \]

If the treatment SS is large compared to error SS, the means differ; this is tested by an F-ratio.

Assignable and Chance Causes

A \(t\)-test compares two means; for three or more, testing every pair separately inflates the chance of a false difference, and ANOVA tests them all at once. Fisher developed it in the 1920s for agricultural field trials. In his words, it is “the separation of the variance ascribable to one group of causes from the variance ascribable to other groups”.

The variation in any experiment has two kinds of cause:

  1. Assignable causes (controlled variation): differences that can be traced and measured, such as the fertiliser applied.
  2. Chance causes (uncontrolled variation, “error”): the many small influences that cannot be traced separately, such as plot-to-plot differences in soil.

Example. Four fertilisers are each applied to six plots of paddy and the yields recorded. ANOVA splits the total variation in the 24 yields into a part due to the fertilisers and a part due to chance, and asks whether the first is larger than the second can explain.

Assumptions of ANOVA

  1. Observations are independent.
  2. Each population is normally distributed.
  3. Populations have equal variances (homoscedasticity).
  4. Effects are additive (no interaction in one-way ANOVA).

The F-test needs the third assumption above, a common variance \(\sigma^2\) in every group; the linear model below assumes it in writing \(D(y) = \sigma^2 I\).

Bartlett's Test for Equality of Variances

STATEMENT

To test \(H_0: \sigma_1^2 = \sigma_2^2 = \cdots = \sigma_k^2\) from \(k\) independent samples from normal populations, of sizes \(n_1, \ldots, n_k\) with \(N = \sum n_i\), let \(s_i^2\) be the variance of sample \(i\) (divisor \(n_i - 1\)) and

\[ s_p^2 = \frac{\sum_{i=1}^{k} (n_i - 1)\, s_i^2}{N - k} \]

the pooled variance, which is the error mean square of the one-way ANOVA. Bartlett's statistic is

\[ \chi^2 = \frac{(N-k)\ln s_p^2 - \sum_{i=1}^{k} (n_i - 1)\ln s_i^2}{C}, \qquad C = 1 + \frac{1}{3(k-1)}\left(\sum_{i=1}^{k} \frac{1}{n_i - 1} - \frac{1}{N-k}\right), \]

with natural logarithms. Under \(H_0\) it is approximately \(\chi^2\) with \(k - 1\) degrees of freedom, and \(H_0\) is rejected for large values.

Why it works. \(s_p^2\) is a weighted arithmetic mean of the \(s_i^2\), with weights \((n_i - 1)/(N - k)\), and \(\exp\!\big[\sum (n_i-1)\ln s_i^2/(N-k)\big]\) is their weighted geometric mean. The arithmetic mean is never smaller than the geometric mean, and the two are equal only when every \(s_i^2\) is the same; so the numerator is never negative and grows as the variances spread apart. \(C\) is a correction that brings the \(\chi^2\) approximation closer for small samples.

Caution. The test leans heavily on normality: a heavy-tailed population can make it reject even when the variances are equal. Check normality first.

EXAMPLE — BARTLETT'S TEST ON THE THREE MACHINES

Given. The outputs of machines A, B and C in Worked Problem 1 below: \(n_1 = 7\), \(n_2 = 5\), \(n_3 = 6\), \(N = 18\), \(k = 3\). Asked. Is the assumption of a common variance tenable at the 5% level?

Step 1 — the sample variances. From the totals in that problem, \(\sum (y - \bar y)^2 = \sum y^2 - T^2/n\):

\[ \begin{aligned} \text{A:}&\quad 3907 - 3889.286 = 17.714, &\quad s_1^2 &= 17.714/6 = 2.952; \\ \text{B:}&\quad 2430 - 2420 = 10, &\quad s_2^2 &= 10/4 = 2.500; \\ \text{C:}&\quad 3760 - 3750 = 10, &\quad s_3^2 &= 10/5 = 2.000. \end{aligned} \]

Step 2 — the pooled variance. \(s_p^2 = (17.714 + 10 + 10)/15 = 37.714/15 = 2.514\), the error mean square of the ANOVA.

Step 3 — the numerator.

\[ \begin{aligned} (N-k)\ln s_p^2 &= 15 \times 0.92199 = 13.8298, \\ \sum (n_i - 1)\ln s_i^2 &= 6(1.08261) + 4(0.91629) + 5(0.69315) \\ &= 6.4957 + 3.6652 + 3.4657 = 13.6266, \\ \text{numerator} &= 13.8298 - 13.6266 = 0.2033. \end{aligned} \]

Step 4 — the correction.

\[ C = 1 + \frac{1}{3 \times 2}\left(\frac16 + \frac14 + \frac15 - \frac1{15}\right) = 1 + \frac{0.55}{6} = 1.0917. \]

Step 5 — the statistic and the decision. \(\chi^2 = 0.2033/1.0917 = 0.186\) on \(2\) degrees of freedom. The 5% point of \(\chi^2_2\) is \(5.991\), and \(0.186 \lt 5.991\), so do not reject \(H_0\) (the \(p\)-value is \(0.911\)).

Interpretation. Sample variances of 2.95, 2.50 and 2.00 differ no more than chance would make them, so the common-variance assumption behind the F-test of Worked Problem 1 is tenable.

Cochran's Theorem

STATEMENT

Let \(X_1, \ldots, X_n\) be independent \(N(0, \sigma^2)\), and suppose

\[ \sum_{i=1}^n X_i^2 = Q_1 + Q_2 + \cdots + Q_k , \]

where each \(Q_j\) is a quadratic form in the \(X_i\) with rank \(r_j\). Then \(Q_1/\sigma^2, \ldots, Q_k/\sigma^2\) are independent \(\chi^2\) variates with \(r_1, \ldots, r_k\) degrees of freedom if and only if \(r_1 + r_2 + \cdots + r_k = n\).

ANOVA uses it directly: the total sum of squares is split into pieces whose degrees of freedom add up to the total, so the pieces are independent chi-squares, and their mean squares can be compared by an F-ratio.

The Gauss–Markov Linear Model

MATRIX FORM

For \(n\) observations and \(m\) unknown parameters,

\[ y = A\beta + \varepsilon, \qquad y = \begin{bmatrix} y_1 \\ \vdots \\ y_n \end{bmatrix},\; A = \begin{bmatrix} a_{11} & \cdots & a_{1m} \\ \vdots & & \vdots \\ a_{n1} & \cdots & a_{nm} \end{bmatrix},\; \beta = \begin{bmatrix} \beta_1 \\ \vdots \\ \beta_m \end{bmatrix},\; \varepsilon = \begin{bmatrix} \varepsilon_1 \\ \vdots \\ \varepsilon_n \end{bmatrix}, \]

with \(A\) a known \(n \times m\) matrix of coefficients, and

  1. \(E(\varepsilon) = 0\), i.e. \(E(\varepsilon_i) = 0\) for every \(i\);
  2. \(E(\varepsilon\varepsilon') = \sigma^2 I\): each \(\varepsilon_i\) has variance \(\sigma^2\), and different errors are uncorrelated;
  3. for the tests, \(\varepsilon \sim N(0, \sigma^2 I)\), so \(y \sim N(A\beta, \sigma^2 I)\).

Then \(E(y_i) = a_{i1}\beta_1 + \cdots + a_{im}\beta_m\), \(\text{Var}(y_i) = \sigma^2\) and \(\text{Cov}(y_i, y_j) = 0\) for \(i \ne j\); \(D(y) = \sigma^2 I\) is the dispersion matrix of \(y\). Assumptions 1 and 2 are enough for least squares to give the best linear unbiased estimates; normality is added for the F-tests.

FIXED, RANDOM AND MIXED EFFECTS

This unit uses the fixed effects model throughout.

2. One-way ANOVA

One factor with \(k\) treatments (or levels). Within treatment \(i\), there are \(n_i\) observations. Total \(N = \sum n_i\).

Mathematical Model

\[ y_{ij} = \mu + \alpha_i + \epsilon_{ij}, \quad i = 1, \ldots, k;\; j = 1, \ldots, n_i, \]

with \(\sum_i n_i \alpha_i = 0\) and \(\epsilon_{ij} \sim N(0, \sigma^2)\) independently.

Hypotheses

\(H_0: \alpha_1 = \alpha_2 = \cdots = \alpha_k = 0\) (all treatment means equal) vs \(H_1\): at least one differs.

Sums of Squares (equal or unequal \(n\))

Let \(T_i = \sum_j y_{ij}\) (treatment total), \(G = \sum_i T_i\) (grand total). Correction Factor \(C = G^2/N\).

\[ \text{SS}_T = \sum_{ij} y_{ij}^2 - C \] \[ \text{SS}_{Tr} = \sum_i \dfrac{T_i^2}{n_i} - C \] \[ \text{SS}_E = \text{SS}_T - \text{SS}_{Tr} \]

ANOVA Table — One-way

SourceSSdfMSF
Treatments\(\text{SS}_{Tr}\)\(k-1\)\(\text{MS}_{Tr}\)\(\text{MS}_{Tr}/\text{MS}_E\)
Error\(\text{SS}_E\)\(N-k\)\(\text{MS}_E\)—
Total\(\text{SS}_T\)\(N-1\)——

Reject \(H_0\) if \(F > F_{\alpha,\, k-1,\, N-k}\).

EXAMPLE 1 (Equal n)

Yields (kg/plot) for 3 fertilizers, each in 4 plots:

F122262428
F230343236
F320222422

\(T_1 = 100,\; T_2 = 132,\; T_3 = 88;\;G = 320;\; N = 12;\; C = 320^2/12 = 8533.33\).

\[ \begin{aligned} \sum y^2 &= 484 + 676 + 576 + 784 + 900 + 1156 + 1024 + 1296 + 400 + 484 \\ &\quad + 576 + 484 = 8840 \end{aligned} \].

\(\text{SS}_T = 8840 - 8533.33 = 306.67\).

\[ \begin{aligned} \text{SS}_{Tr} &= (100^2 + 132^2 + 88^2)/4 - 8533.33 = (10000 + 17424 + 7744)/4 - 8533.33 \\ &= 8792 - 8533.33 = 258.67 \end{aligned} \].

\(\text{SS}_E = 306.67 - 258.67 = 48.0\).

F = (258.67/2)/(48/9) = 129.33/5.33 = 24.25. df = (2, 9). \(F_{0.05, 2, 9} = 4.26\) ⇒ reject \(H_0\); fertilizers differ significantly.

EXAMPLE 2 (Unequal n)

Yields for 3 varieties: V1 (n₁=3): 20, 24, 22; V2 (n₂=4): 28, 30, 32, 34; V3 (n₃=2): 18, 20.

\(T_1 = 66, T_2 = 124, T_3 = 38, G = 228, N = 9, C = 228^2/9 = 5776\).

\(\sum y^2 = 400 + 576 + 484 + 784 + 900 + 1024 + 1156 + 324 + 400 = 6048\).

\(\text{SS}_T = 6048 - 5776 = 272\).

\(\text{SS}_{Tr} = 66^2/3 + 124^2/4 + 38^2/2 - 5776 = 1452 + 3844 + 722 - 5776 = 242\).

\(\text{SS}_E = 272 - 242 = 30\). df: treatment 2, error 6.

\(F = (242/2)/(30/6) = 121/5 = 24.2 > F_{0.05, 2, 6} = 5.14\) ⇒ reject \(H_0\).

Least-Squares Estimates

NORMAL EQUATIONS

Here \(\mu_i = \mu + \alpha_i\) is the mean of treatment \(i\), \(\mu = \frac1N\sum n_i\mu_i\), and \(\alpha_i = \mu_i - \mu\), so \(\sum n_i\alpha_i = \sum n_i\mu_i - N\mu = 0\). Minimise the error sum of squares \(E = \sum_i\sum_j (y_{ij} - \mu - \alpha_i)^2\):

\[ \frac{\partial E}{\partial \mu} = -2\sum_i\sum_j (y_{ij} - \mu - \alpha_i) = 0 \;\Longrightarrow\; N\bar y_{..} - N\mu - \sum n_i\alpha_i = 0 \;\Longrightarrow\; \hat\mu = \bar y_{..}, \] \[ \frac{\partial E}{\partial \alpha_i} = -2\sum_j (y_{ij} - \mu - \alpha_i) = 0 \;\Longrightarrow\; n_i\bar y_{i.} - n_i\mu - n_i\alpha_i = 0 \;\Longrightarrow\; \hat\alpha_i = \bar y_{i.} - \bar y_{..} . \]

The residual is \(\hat\varepsilon_{ij} = y_{ij} - \hat\mu - \hat\alpha_i = y_{ij} - \bar y_{i.}\).

Partitioning the Total Sum of Squares

PROOF OF THE IDENTITY

Write each observation as estimate plus residual: \(y_{ij} - \bar y_{..} = (\bar y_{i.} - \bar y_{..}) + (y_{ij} - \bar y_{i.})\). Squaring and summing over \(i\) and \(j\),

\[ \sum_i\sum_j (y_{ij} - \bar y_{..})^2 = \sum_i n_i(\bar y_{i.} - \bar y_{..})^2 + \sum_i\sum_j (y_{ij} - \bar y_{i.})^2 \] \[ + \; 2\sum_i (\bar y_{i.} - \bar y_{..})\sum_j (y_{ij} - \bar y_{i.}) . \]

The last term is zero because \(\sum_j (y_{ij} - \bar y_{i.}) = n_i\bar y_{i.} - n_i\bar y_{i.} = 0\). So TSS = SST + SSE.

Degrees of freedom. TSS has \(N - 1\) (the \(N\) deviations satisfy \(\sum\sum (y_{ij} - \bar y_{..}) = 0\)); SST has \(k - 1\) (the \(k\) deviations satisfy \(\sum n_i(\bar y_{i.} - \bar y_{..}) = 0\)); SSE has \(N - k\) (its \(N\) deviations satisfy one constraint \(\sum_j (y_{ij} - \bar y_{i.}) = 0\) in each of the \(k\) groups). The degrees of freedom add up as the sums of squares do: \((k - 1) + (N - k) = N - 1\).

Shortcut formulas. Expanding the squares gives TSS \(= \sum\sum y_{ij}^2 - G^2/N\) and SST \(= \sum T_i^2/n_i - G^2/N\), where \(G^2/N\) is the correction factor.

Expected Mean Squares

WHY THE F-RATIO WORKS

Averaging the model gives \(\bar y_{i.} = \mu + \alpha_i + \bar\varepsilon_{i.}\) and \(\bar y_{..} = \mu + \bar\varepsilon_{..}\) (using \(\sum n_i\alpha_i = 0\)), with \(E(\bar\varepsilon_{i.}^2) = \sigma^2/n_i\) and \(E(\bar\varepsilon_{..}^2) = \sigma^2/N\). Then

\[ \text{SST} = \sum n_i\big[\alpha_i + (\bar\varepsilon_{i.} - \bar\varepsilon_{..})\big]^2, \qquad \sum n_i(\bar\varepsilon_{i.} - \bar\varepsilon_{..})^2 = \sum n_i\bar\varepsilon_{i.}^2 - N\bar\varepsilon_{..}^2 , \]

and the cross term has expectation zero, so

\[ E(\text{SST}) = \sum n_i\alpha_i^2 + \sum n_i\frac{\sigma^2}{n_i} - N\frac{\sigma^2}{N} = \sum n_i\alpha_i^2 + (k-1)\sigma^2 . \]

Similarly \(\text{SSE} = \sum\sum (\varepsilon_{ij} - \bar\varepsilon_{i.})^2\) \(= \sum\sum\varepsilon_{ij}^2 - \sum n_i\bar\varepsilon_{i.}^2\), so \(E(\text{SSE}) = N\sigma^2 - k\sigma^2 = (N-k)\sigma^2\). Dividing by the degrees of freedom,

\[ E(\text{MS}_{Tr}) = \sigma^2 + \frac{1}{k-1}\sum n_i\alpha_i^2, \qquad E(\text{MS}_E) = \sigma^2 . \]

The error mean square estimates \(\sigma^2\) whatever the treatments do; the treatment mean square estimates \(\sigma^2\) only when \(H_0\) holds, and something larger otherwise. Under \(H_0\), by Cochran's theorem, \(\text{SST}/\sigma^2\) and \(\text{SSE}/\sigma^2\) are independent \(\chi^2_{k-1}\) and \(\chi^2_{N-k}\), so

\[ F = \frac{\text{SST}/(k-1)}{\text{SSE}/(N-k)} = \frac{\text{MS}_{Tr}}{\text{MS}_E} \sim F_{k-1,\,N-k} . \]

Large values of \(F\) count against \(H_0\), so the test uses the upper tail only. An \(F\) below 1 is never significant, and the ratio is never turned upside down to make it exceed 1.

Critical Difference

WHICH PAIRS DIFFER?

When \(H_0\) is rejected, the next question is which treatments differ. Two means differ significantly at level \(\alpha\) when their difference exceeds the critical difference (least significant difference)

\[ \text{CD} = t_{\alpha/2,\,N-k}\,\sqrt{\text{MS}_E\Big(\frac{1}{n_i} + \frac{1}{n_j}\Big)} \;=\; t_{\alpha/2,\,N-k}\,\sqrt{\frac{2\,\text{MS}_E}{n}} \;\text{ when every } n_i = n . \]

This is the two-sample \(t\)-test with the pooled error mean square in place of \(\sigma^2\) (which is why \(t\), on the error degrees of freedom, and not \(z\)); \(t_{\alpha/2}\) is the two-tailed point.

Wording. A non-significant \(F\) means the data show no evidence of a difference; it does not prove the means equal. “Accept \(H_0\)” should always be read as “do not reject \(H_0\)”.

3. Two-way ANOVA (one observation per cell)

Two factors A (rows, \(r\) levels) and B (columns, \(c\) levels). Each combination has one observation \(y_{ij}\).

Mathematical Model

\[ y_{ij} = \mu + \alpha_i + \beta_j + \epsilon_{ij}, \]

with \(\sum \alpha_i = 0,\; \sum \beta_j = 0,\; \epsilon_{ij} \sim N(0, \sigma^2)\).

Hypotheses

Sums of Squares

Let \(R_i = \sum_j y_{ij}\) (row totals), \(C_j = \sum_i y_{ij}\) (column totals), \(G = \sum y_{ij}\), \(N = rc\), \(C = G^2/N\).

\[ \text{SS}_T = \sum y^2 - C, \quad \text{SS}_R = \dfrac{\sum R_i^2}{c} - C, \quad \text{SS}_C = \dfrac{\sum C_j^2}{r} - C, \] \[ \text{SS}_E = \text{SS}_T - \text{SS}_R - \text{SS}_C. \]

ANOVA Table — Two-way

SourceSSdfMSF
Rows\(\text{SS}_R\)\(r-1\)\(\text{MS}_R\)\(\text{MS}_R/\text{MS}_E\)
Columns\(\text{SS}_C\)\(c-1\)\(\text{MS}_C\)\(\text{MS}_C/\text{MS}_E\)
Error\(\text{SS}_E\)\((r-1)(c-1)\)\(\text{MS}_E\)—
Total\(\text{SS}_T\)\(N-1\)——
EXAMPLE 1

3 fertilizers (rows) × 4 varieties (columns). Yields:

F\VV1V2V3V4Row total
F11012141652
F21416182068
F3810121444
Col total32384450164

\(N = 12, C = 164^2/12 = 2241.33\).

\[ \begin{aligned} \sum y^2 &= 100 + 144 + 196 + 256 + 196 + 256 + 324 + 400 + 64 + 100 \\ &\quad + 144 + 196 = 2376 \end{aligned} \].

\(\text{SS}_T = 2376 - 2241.33 = 134.67\).

\[ \begin{aligned} \text{SS}_R &= (52^2 + 68^2 + 44^2)/4 - 2241.33 = (2704 + 4624 + 1936)/4 - 2241.33 \\ &= 9264/4 - 2241.33 = 2316 - 2241.33 = 74.67 \end{aligned} \].

\[ \begin{aligned} \text{SS}_C &= (32^2 + 38^2 + 44^2 + 50^2)/3 - 2241.33 = 6904/3 - 2241.33 \\ &= 2301.33 - 2241.33 = 60 \end{aligned} \].

\(\text{SS}_E = 134.67 - 74.67 - 60 = 0\) (linear data give zero error). df: rows 2, cols 3, error 6.

EXAMPLE 2

4 students (rows) × 3 subjects (cols). \(\text{SS}_R = 70,\; \text{SS}_C = 30,\; \text{SS}_E = 60\). df: 3, 2, 6.

\(F_R = (70/3)/(60/6) = 23.33/10 = 2.33;\; F_{0.05, 3, 6} = 4.76\) ⇒ not significant (no evidence of a student effect).

\(F_C = (30/2)/(60/6) = 15/10 = 1.5;\; F_{0.05, 2, 6} = 5.14\) ⇒ not significant (no evidence of a subject effect).

Deriving the Two-way Analysis

ESTIMATES AND THE PARTITION

Write \(k\) treatments (rows, \(i\)) and \(h\) varieties or blocks (columns, \(j\)), \(N = hk\); in the notation above \(r = k\), \(c = h\). With \(\sum\alpha_i = 0\) and \(\sum\beta_j = 0\), minimising \(\sum\sum (y_{ij} - \mu - \alpha_i - \beta_j)^2\) gives, exactly as in one-way,

\[ \hat\mu = \bar y_{..}, \qquad \hat\alpha_i = \bar y_{i.} - \bar y_{..}, \qquad \hat\beta_j = \bar y_{.j} - \bar y_{..}, \]

and residual \(y_{ij} - \bar y_{i.} - \bar y_{.j} + \bar y_{..}\). Then

\[ y_{ij} - \bar y_{..} = (\bar y_{i.} - \bar y_{..}) + (\bar y_{.j} - \bar y_{..}) + (y_{ij} - \bar y_{i.} - \bar y_{.j} + \bar y_{..}), \]

and on squaring and summing, all three cross products vanish (each contains a sum of deviations from a mean over a full row or column):

\[ \underbrace{\sum\sum (y_{ij} - \bar y_{..})^2}_{\text{TSS}} = \underbrace{h\sum_i (\bar y_{i.} - \bar y_{..})^2}_{\text{SST}} + \underbrace{k\sum_j (\bar y_{.j} - \bar y_{..})^2}_{\text{SSV}} \] \[ + \underbrace{\sum\sum (y_{ij} - \bar y_{i.} - \bar y_{.j} + \bar y_{..})^2}_{\text{SSE}} . \]

Degrees of freedom: \(hk - 1\) \(= (k - 1) + (h - 1) + (h-1)(k-1)\), the error taking what is left over.

EXPECTED MEAN SQUARES AND THE TWO F-TESTS

With \(\bar y_{i.} = \mu + \alpha_i + \bar\varepsilon_{i.}\), \(\bar y_{.j} = \mu + \beta_j + \bar\varepsilon_{.j}\), \(\bar y_{..} = \mu + \bar\varepsilon_{..}\) and \(E(\bar\varepsilon_{i.}^2) = \sigma^2/h\), \(E(\bar\varepsilon_{.j}^2) = \sigma^2/k\), \(E(\bar\varepsilon_{..}^2) = \sigma^2/hk\):

\[ E(\text{SST}) = h\sum\alpha_i^2 + (k-1)\sigma^2, \qquad E(\text{SSV}) = k\sum\beta_j^2 + (h-1)\sigma^2 . \]

For the error, the residual equals \(\varepsilon_{ij} - \bar\varepsilon_{i.} - \bar\varepsilon_{.j} + \bar\varepsilon_{..}\); expanding its square and taking expectations term by term,

\[ E(\text{SSE}) = \big(hk + k + h + 1 - 2k - 2h\big)\sigma^2 = (h-1)(k-1)\sigma^2 . \]

So \(\text{MS}_E\) always estimates \(\sigma^2\), and

\[ F_T = \frac{\text{MS}_T}{\text{MS}_E} \sim F_{k-1,\,(h-1)(k-1)} \;\text{ under } H_T: \alpha_i = 0, \] \[ F_V = \frac{\text{MS}_V}{\text{MS}_E} \sim F_{h-1,\,(h-1)(k-1)} \;\text{ under } H_V: \beta_j = 0 . \]

Shortcuts: SST \(= \frac1h\sum T_{i.}^2 - \text{CF}\), SSV \(= \frac1k\sum T_{.j}^2 - \text{CF}\), SSE \(=\) TSS \(-\) SST \(-\) SSV.

4. Factorial Experiments (\(2^2\) and \(2^3\))

In a factorial experiment several factors are varied together, so that both their individual (main) effects and their interactions can be estimated from the same trials — far more efficient than studying one factor at a time. In a \(2^k\) design each of \(k\) factors is set at two levels, low and high.

For a \(2^2\) design with factors A and B, the four treatment combinations are written \((1),\ a,\ b,\ ab\) (a letter present = that factor at its high level). The effects are contrasts:

\[ \begin{gathered} A = \tfrac{1}{2r}\big[a + ab - b - (1)\big], \quad B = \tfrac{1}{2r}\big[b + ab - a - (1)\big], \\ AB = \tfrac{1}{2r}\big[(1) + ab - a - b\big], \end{gathered} \] \[ SS_{\text{effect}} = \dfrac{(\text{contrast})^{2}}{2^{k}\,r}. \]

A significant interaction means the effect of one factor depends on the level of the other — then the main effects must not be interpreted in isolation.

EXAMPLE (\(2^2\), single replicate)

Yields: \((1) = 20,\ a = 40,\ b = 30,\ ab = 54\).

Factor A has the dominant effect; the interaction is negligible.

YATES' ALGORITHM

Yates' algorithm computes all contrasts systematically. List the responses in standard order \((1), a, b, ab\) and repeat, \(k\) times, the operation "sum the pairs, then difference the pairs":

Std orderResponseColumn 1Column 2 (contrast)Identifies
(1)2060144Grand total
a408444A
b302024B
ab54244AB

The final column reproduces the contrasts (44, 24, 4) and the grand total (144). The same "add-then-subtract" scheme with three passes handles a \(2^3\) design (factors A, B, C and interactions AB, AC, BC, ABC).

No interaction (parallel) Interaction (lines cross) A lowA high A lowA high Mean response B low B high
Fig 1.1 — Interaction plot: mean response against factor A, with a separate line for each level of B. Parallel lines (left) mean the effect of A is the same at both levels of B — no interaction. Lines that cross or diverge (right) mean the effect of A depends on B — a significant interaction, so the main effects must not be read in isolation.

Worked Problems on Analysis of Variance

Two problems, one-way then two-way, followed by two exercises with answers. Each follows the same steps: hypotheses, totals, correction factor, sums of squares, ANOVA table, and the comparison with the tabulated \(F\). The tabulated values of \(F\) and \(t\) here are computed rather than read from a table, and every figure is exact until it is written down.

A. One-way Classification

WORKED PROBLEM 1 — three machines, unequal numbers

Three machines A, B and C are timed to see whether their hourly outputs are equivalent:

MachineOutput (units per hour)\(T_i\)\(n_i\)\(T_i^2/n_i\)\(\sum_j y_{ij}^2\)
A22, 25, 24, 21, 26, 23, 2416573889.2863907
B20, 23, 22, 21, 24110524202430
C25, 23, 27, 26, 24, 25150637503760
Total4251810059.28610097

Hypotheses. \(H_0: \mu_1 = \mu_2 = \mu_3\) (the machines have the same mean output) against \(H_1\): not all equal.

Sums of squares. \(G = 425\), \(N = 18\), \(\text{CF} = 425^2/18 = 10034.722\).

\[ \begin{gathered} \text{TSS} = 10097 - 10034.722 = 62.278, \\ \text{SST} = 10059.286 - 10034.722 = 24.563, \qquad \text{SSE} = 62.278 - 24.563 = 37.714 . \end{gathered} \]
SourceSSd.f.MS\(F\)
Between machines24.563212.2817\(12.2817/2.5143 = 4.885\)
Within machines (error)37.714152.5143
Total62.27817

Decision. \(F_{0.05}(2, 15) = 3.68\), and \(4.885 > 3.68\) (\(p = 0.023\)), so \(H_0\) is rejected: the machines differ in mean output (means 23.57, 22.00, 25.00).

A significant \(F\) says only that not all the means are equal; which ones differ is a further question, taken up in Worked Problem 2. Machine C is the obvious candidate, but that has to be tested, not read off the means.

B. Two-way Classification

WORKED PROBLEM 2 — five fertilisers, four blocks

Five fertilisers, A to E, are each tried once in four blocks of land; the yields (quintals per plot) are below. Test at the 1% level whether the fertilisers differ, and whether the blocks differ.

BlockABCDE\(T_{.j}\)\(T_{.j}^2\)
1182423222911613456
2212725263113016900
3192224202711212544
4202628273413518225
\(T_{i.}\)789910095121\(G = 493\)61125
\(T_{i.}^2\)608498011000090251464149551

Hypotheses. \(H_T\): the five fertilisers have equal effects; \(H_B\): the four blocks have equal effects.

Sums of squares. \(k = 5\) fertilisers, \(h = 4\) blocks, \(N = 20\), \(\text{CF} = 493^2/20 = 12152.45\), \(\sum\sum y^2 = 12481\).

\[ \text{TSS} = 12481 - 12152.45 = 328.55, \qquad \text{SS}_T = \frac{49551}{4} - 12152.45 = 235.30, \] \[ \text{SS}_B = \frac{61125}{5} - 12152.45 = 72.55, \qquad \text{SSE} = 328.55 - 235.30 - 72.55 = 20.70 . \]
SourceSSd.f.MS\(F\)\(F_{0.01}\)
Fertilisers235.30458.82534.105.41
Blocks72.55324.18314.025.95
Error20.70121.7250
Total328.5519

Decision. Fertilisers: \(34.10 > 5.41\) (\(p < 0.0001\)), so the fertilisers differ significantly. Blocks: \(14.02 > 5.95\) (\(p = 0.0003\)), so the blocks also differ significantly: blocking has removed real variation from the error. The level must be fixed before the data are seen.

Which fertilisers differ? The means are A 19.50, B 24.75, C 25.00, D 23.75, E 30.25. With \(t_{0.005}(12) = 3.055\),

\[ \text{CD}_{1\%} = 3.055\sqrt{\frac{2 \times 1.7250}{4}} = 3.055 \times 0.929 = 2.84 . \]

Pairs further apart than 2.84: A–B, A–C, A–D, A–E, B–E, C–E, D–E. At 5% (\(\text{CD}_{5\%} = 2.179 \times 0.929 = 2.02\)) these also differ: no further pairs.

17 19 21 23 25 27 29 31 33 A 19.5 B 24.75 C 25 D 23.75 E 30.25 CD at 5% = 2.02 CD at 1% = 2.84 mean yield per fertiliser (4 blocks each)
Fig 1.2 — Worked Problem 2. Two fertiliser means differ significantly when they are further apart than the critical difference (the red bar at 1%, the green bar at 5%).

Exercises on Analysis of Variance, with Answers Checked

PRACTICE
  1. Prices of a commodity (₹ per kg) in seven shops in each of four markets. Test (one-way) whether the markets differ.
    Market1234567
    A74716977726875
    B78758073767974
    C70736875716972
    D76727874797377
    Ans. SST \(= 135.71\), SSE \(= 181.71\); \(\text{MS}_{Tr} = 45.24\), \(\text{MS}_E = 7.57\); \(F = 5.97\) on (3, 24) d.f., above \(F_{0.05} = 3.01\): the markets differ significantly. Put the treatment mean square on top: the ratio is \(\text{MS}_{Tr}/\text{MS}_E\) whichever is larger.
  2. Four fertilisers, each applied to five plots (a two-way layout, fertilisers by plots):
    FertiliserIIIIIIIVV
    12.42.73.12.32.6
    22.92.52.83.12.7
    32.22.42.72.52.6
    42.62.33.02.82.9
    Ans. SST \(= 0.2855\), SS(plots) \(= 0.447\), SSE \(= 0.597\); \(\text{MS}_T = 0.0952\), \(\text{MS}_B = 0.1118\), \(\text{MS}_E = 0.0498\); \(F_T = 1.913\) (below \(F_{0.05}(3, 12) = 3.49\)) and \(F_B = 2.246\) (below \(F_{0.05}(4, 12) = 3.26\)).

Key Take-aways

Extra Practical Problems

PRACTICE

Additional worked problems with step-by-step procedures to support self-study, matching this unit's topics.

STEP-BY-STEP PROCEDURE (one-way ANOVA)
  1. State \(H_0: \mu_1 = \mu_2 = \cdots = \mu_k\) (all treatment means equal) vs \(H_1\): not all equal; fix \(\alpha\).
  2. Grand total \(G = \sum\sum x_{ij}\); correction factor \(C = G^2/N\).
  3. Total SS: \(\text{TSS} = \sum\sum x_{ij}^2 - C\).
  4. Treatment SS: \(\text{SST} = \sum \dfrac{T_i^2}{n_i} - C\) (each treatment total squared over its own count).
  5. Error SS: \(\text{SSE} = \text{TSS} - \text{SST}\).
  6. Degrees of freedom: Treatment \(= k-1\), Error \(= N-k\), Total \(= N-1\).
  7. Mean squares: \(\text{MST} = \dfrac{\text{SST}}{k-1}\), \(\text{MSE} = \dfrac{\text{SSE}}{N-k}\); then \(F = \dfrac{\text{MST}}{\text{MSE}}\).
  8. Compare \(F\) with \(F_{\alpha}(k-1, N-k)\). If \(F_{cal} > F_{tab}\), treatments differ significantly.
  9. For pairwise comparison, \(\text{CD (LSD)} = t_{\alpha/2,\,\text{error df}}\times \sqrt{\text{MSE}\left(\frac{1}{n_i}+\frac{1}{n_j}\right)}\).

Assumptions: observations are independent, normally distributed, with equal variances. Three principles of design: replication, randomization, local control.

Problem 1 — One-way ANOVA (worked example)

DATA

Grain yield of rice (kg/ha) from 7 insecticide treatments, each with 4 replications (a one-way layout). Treatment totals (T) and grand total \(G = 57110\), \(N = 28\):

TreatmentR1R2R3R4Total
Dol-mix25372069210417978507
Ferterra336625912211254410712
DDT+γ-BHC253624592827238510207
Standard23872453155621168512
Dimecron-Boom19971679164918597184
Dimecron-Knap17961704190413206724
Control14011516127010775264

Correction factor \(C = G^2/N = 57110^2/28 = 116484004\).

\(\text{TSS} = \sum y^2 - C = 7577412\); \(\text{Treatment SS} = \sum T_i^2/4 - C = 5587175\); \(\text{Error SS} = 7577412 - 5587175 = 1990238\).

SourcedfSSMS\(F\)\(F_{0.05}\)
Treatment655871759311969.832.57
Error21199023894773
Total277577412

Since \(F = 9.83 > 2.57\), treatments differ significantly. SE of difference \(=\sqrt{\frac{2\times94773}{4}} = 217.68\); \(CD_{0.05} = 217.68\times 2.08 = 452.70\) kg/ha, \(CD_{0.01} = 217.68\times 2.831 = 616.34\) kg/ha (with \(t_{0.005}(21) = 2.8314\)). Compared with the control, all treatments except Dimecron-Knap give a significant yield increase.

Unsolved Exercises

PRACTICE
  1. Explain the analysis of one-way classification.
  2. What do you understand by the analysis of variance?
  3. State the assumptions of the analysis of variance.