This study is a valid latin square because each of the five ingredients appears exactly once in each batch and exactly once on each day. Therefore, the effects of batch and day can be controlled as two blocking factors.
Model equation:
\[ y_{ijk} = \mu + \tau_i + \beta_j + \lambda_k + e_{ijk} \]
Hypothesis:
\[ H_0 : \tau_i = 0 , \forall i \\ H_1 : \tau_i \ne 0, \text{some } i \] ANOVA:
## Df Sum Sq Mean Sq F value Pr(>F)
## batch 4 15.44 3.86 1.235 0.347618
## day 4 12.24 3.06 0.979 0.455014
## ingredients 4 141.44 35.36 11.309 0.000488 ***
## Residuals 12 37.52 3.13
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Since the p-value for ingredients is less than \(\alpha = 0.05\), there is enough evidence to reject \(H_0\). Therefore, there is a significant difference in mean reaction time among the five ingredients.
#latin square with anova
batch = c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
day = c(seq(1,5),seq(1,5),seq(1,5),seq(1,5),seq(1,5))
ingredients = c("A", "B", "D", "C", "E",
"C", "E", "A", "D", "B",
"B", "A", "C", "E", "D",
"D", "C", "E", "B", "A",
"E", "D", "B", "A", "C")
obs = c("8", "7", "1", "7", "3",
"11", "2", "7", "3", "8",
"4", "9", "10", "1", "5",
"6", "8", "6", "6", "10",
"4", "2", "3", "8", "8")
batch <- as.factor(batch)
day <- as.factor(day)
ingredients <- as.factor(ingredients)
aov_model <- aov(obs ~ batch + day + ingredients)
summary(aov_model)