Yes. In a 5x5 Latin square, each treatment must appear exactly once per row and exactly once per column. Here, every ingredient (A, B, C, D, E) shows up exactly one time in each batch and one time on each day.
\[y_{ijk} = \mu + \alpha_i + \tau_j + \beta_k + \epsilon_{ijk}\]
Where \(\mu\) is the overall mean, \(\alpha_i\) is the batch effect, \(\tau_j\) is the ingredient effect, \(\beta_k\) is the day effect, and \(\epsilon_{ijk}\) is the random error.
# load data
Batch <- as.factor(rep(1:5, each = 5))
Day <- as.factor(rep(1:5, times = 5))
Ingredient <- as.factor(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"))
Time <- 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)
df <- data.frame(Batch, Day, Ingredient, Time)
# run anova
model <- aov(Time ~ Batch + Day + Ingredient, data = df)
summary(model)
## 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
## Ingredient 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