logo

Two-way ANOVA 📂Statistical Test

Two-way ANOVA

Hypothesis Testing 1

Suppose there are $k$ treatments and $b$ blocks in an experimental design, from which $n = bk$ samples are obtained. Assume that the samples of the $j = 1 , \cdots , k$th treatment are independently and randomly distributed following a normal distribution $N \left( \mu_{j} , \sigma_{j}^{2} \right)$, with the population variance of each normal distribution being equal, i.e., $\sigma^{2} = \sigma_{1}^{2} = \cdots = \sigma_{k}^{2}$. In the two-way ANOVA for comparing population means across groups, the hypothesis test is as follows:

  • $H_{0}$: $\mu_{1} = \cdots = \mu_{k}$
  • $H_{1}$: At least one $\mu_{j}$ is different from the others.

Test Statistic

Assume the ANOVA table is provided under a randomized block design.

SourcedfSSMSF
Treatments$k-1$SSTMSTMST/MSE
Blocks$b-1$SSBMSB
Error$(k-1)(b-1)$SSEMSE
Total$n-1$TSS

The test statistic is given by: $$ F = {\frac{ \text{MST} }{ \text{MSE} }} = {\frac{ \text{SST} / (k - 1) }{ \text{SSE} / (k - 1)(b - 1) }} $$ This test statistic follows an F-distribution $F \left( k - 1 , (k - 1)(b - 1) \right)$ with $(k-1), (k - 1)(b - 1)$ degrees of freedom under the assumption that the null hypothesis is true.

Explanation

Let the mean for each treatment be denoted as $\bar{x}_{j} := \sum_{i} x_{ij} / n_{j}$, and the overall mean as $\bar{x} := \sum_{ij} x_{ij} / n$. $$ \begin{align*} \text{SST} =& \sum_{j=1}^{k} n_{j} \left( \bar{x}_{j} - \bar{x} \right)^{2} \\ \text{SSE} =& \left( n_{1} - 1 \right) s_{1}^{2} + \cdots + \left( n_{k} - 1 \right) s_{k}^{2} \\ \text{SSB} =& \sum_{i=1}^{b} \left( x_{i} - \bar{x} \right)^{2} \\ \text{MST} =& {\frac{ \text{SST} }{ k - 1 }} \\ \text{MSB} =& {\frac{ \text{SSB} }{ b - 1 }} \\ \text{MSE} =& {\frac{ \text{SSE} }{ (b-1)(k-1) }} \\ F =& {\frac{ \text{MST} }{ \text{MSE} }} = {\frac{ \text{SST}/ (k - 1) }{ \text{SSE} / (b-1)(k-1) }} = {\frac{ \text{SST}}{ \text{SSE} / (b-1) }} \end{align*} $$ For the derivation of the test statistic, refer to F-test in ANOVA.

Precautions

One cautionary note is that although a block is added in a two-way ANOVA, the primary focus remains on the differences between treatments, hence $\text{MSB}$ should not be a concern2. It is evident from the test statistic $F$ that it only incorporates $\text{SST}$, which, when compared with the test statistic of one-way ANOVA, differs only in the numerator. Although there is a possibility for a test for differences between blocks, denoted by $F_{B}$, the main focus should first be on differences between treatments. $$ F_{B} = {\frac{ \text{MSB} }{ \text{MSE} }} = {\frac{ \text{SSB} / (b - 1) }{ \text{SSE} / (b-1)(k-1) }} = {\frac{ \text{SSB}}{ \text{SSE} / (k-1) }} $$ Analogously to the original $F$, this test statistic follows an F-distribution $F \left( b - 1 , (b - 1)(k - 1) \right)$ with $(b-1), (b-1)(k-1)$ degrees of freedom under the assumption that the null hypothesis is true.

Example 3

A university seeks to determine if gas usage differs by season: spring, fall, and winter, in its laboratories. Since each lab might have different characteristics or preferences, they decided to use four similar labs A, B, C, and D as blocks to mitigate any discrepancies among them. Using data on seasonal gas usage from these labs, let’s perform an analysis under a randomized block design. The null hypothesis is that the mean gas usage is identical for each season, while the alternative hypothesis is that at least one season has a different mean gas usage.

LabSpringFallWinter
A2768308
B2476326
C3165312
D2367300

The overall mean is 135.6, with seasonal means being 26.3 for spring, 69.0 for fall, and 311.5 for winter.

Given the number of treatments $k = 3$ and blocks $b = 4$, $\text{SST} = 189,335.2$ and $\text{SSE} = 241.5$ allow $F$ to be computed as follows: $$ F = {\frac{ \text{SST} / }{ \text{SSE} /(b - 1) }} = {\frac{ 189,335.2 / 2 }{ 241.5 / 3 }} = 2352.0 $$ Considering $(k-1) = 2$ and $(k-1)(b-1) = 6$, at a significance level $\alpha = 5\%$, the lower bound of the rejection region is $F_{2, 6} (0.05) = 5.14$, and $F \gg 5.14$, thereby allowing the null hypothesis to be rejected. In other words, at least one season’s mean gas usage differs from another.

However, as previously mentioned, it’s unnecessary to strictly test differences according to blocks, but the test statistic for blocks will be $F_{B} = 1.84$, which is smaller than $F_{3, 6} (0.05) = 4.76$, indicating the null hypothesis cannot be rejected. Therefore, gas usage does not significantly differ by lab.

Verification

alt text

See Also

Experimental DesignParametric MethodsNon-Parametric Methods
Completely Randomized DesignOne-Way ANOVAKruskal-Wallis $H$ Test
Randomized Block DesignTwo-Way ANOVAFriedman $F_{r}$ Test

  1. Mendenhall. (2012). Introduction to Probability and Statistics (13th Edition): p471. ↩︎

  2. 경북대학교 통계학과. (2008). 엑셀을 이용한 통계학: p291. ↩︎

  3. Mendenhall. (2012). Introduction to Probability and Statistics (13th Edition): p469. ↩︎