An alternative to RCBDs that works with two nuisance factors.
Assume two nuisance factors, each with \(p\) levels. Furthermore, assume that we care about \(p\) different treatments.
The intuition for Latin Squares is similar to the intuition for RCBD, > Make sure to run each treatment on each nuisance factor exactly once.
For example, in the manufacturing example, each operator should see each treatment once, and each batch of materials should be used for each treatment
A | B | C |
B | C | A |
C | A | B |
Instead of just one set of block effects, we’ll have two sets, \(\alpha_i\) and \(\beta_k\). This results in, \[\begin{align*} y_{ijk} &= \mu + \alpha_i + \tau_j + \beta_k + \epsilon_{ijk} \end{align*}\] where \(\epsilon_{ijk}\sim \mathcal{N}\left(0,\sigma^2\right)\) independently. Note that each of the indices \(i, j\) and \(k\) range from \(1, \dots, p\).
To make the model identifiable, we assume \[ \sum_{i = 1}^{p} \alpha_i = \sum_{j = 1}^{p} \tau_j = \sum_{k = 1}^{p} \beta_{k} = 0 \]
Our test hasn’t changed at all, \[\begin{align*} H_0 &: \tau_1 = \dots = \tau_a = 0 \\ H_{1} &: \tau_{i} \neq 0 \text{ for at least one } i \end{align*}\]
But now we need to account for block-to-block variation across both nuisance factors. The formula isn’t pretty, but it’s exactly analogous to the decompositions we’ve seen before,
\[ \begin{aligned} \sum_{i=1}^{p} \sum_{j=1}^{p} \sum_{k=1}^{p}\left(y_{i j k}-\bar{y} . . .\right)^{2}=& p \sum_{i=1}^{p}\left(\bar{y}_{i . .}-\bar{y} . . .\right)^{2}+\\ & p \sum_{j=1}^{p}\left(\bar{y}_{\cdot j} \cdot \bar{y}_{\cdots} .\right)^{2}+\\ & p \sum_{k=1}^{p}\left(\bar{y}_{\cdot \cdot k}-\bar{y} . .\right)^{2}+\\ & \sum_{i=1}^{p} \sum_{j=1}^{p} \sum_{k=1}^{p}\left(y_{i j k}-\bar{y}_{i . .}-\bar{y}_{. j .}+\bar{y} . .\right)^{2} \end{aligned} \]
library(readr)
library(dplyr)
rocket <- read_table2("https://uwmadison.box.com/shared/static/ac68766l3zcjog1ldrzki3lis74bbd71.txt") %>%
mutate_at(vars(-BurningRate), as.factor) # convert all but BurningRate to factor
rocket
# A tibble: 25 × 4
Batch Operator Formulation BurningRate
<fct> <fct> <fct> <dbl>
1 1 1 a 24
2 1 2 b 20
3 1 3 c 19
4 1 4 d 24
5 1 5 e 24
6 2 1 b 17
7 2 2 c 24
8 2 3 d 30
9 2 4 e 27
10 2 5 a 36
# … with 15 more rows
y ~ .
to refer to the model using all the other variables in the data frame as inputs. Compare the ANOVA table below with Table 4.12.#fit <- lm(BurningRate ~ Batch + Operator + Formulation, data = rocket) # gives exact same result
fit <- lm(BurningRate ~ ., data = rocket)
summary(aov(fit))
Df Sum Sq Mean Sq F value Pr(>F)
Batch 4 68 17.00 1.594 0.23906
Operator 4 150 37.50 3.516 0.04037 *
Formulation 4 330 82.50 7.734 0.00254 **
Residuals 12 128 10.67
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1