Yes, this is a valid latin square as each ingredient appears exactly once in each row and column.
\[Y_{ij} = \mu + \beta_i + \delta_j + \tau_{k(i,j)} + \epsilon_{ij}\]
Where:
\(\mu\) is the overall mean
\(\beta_i\) is the batch effect
\(\delta_j\) is the day effect
\(\tau_{k(i,j)}\) is the ingredient effect
\(H_0\): All five ingredients have equal mean reaction times.
\(H_1\): At least one ingredient has a different mean reaction time.
day <- factor(rep(1:5, times = 5))
batch <- factor(rep(1:5, each = 5))
ingrd <- 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
)
data <- data.frame(batch, day, ingrd, time)
model <- aov(time ~ batch + day + ingrd, data = data)
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
## ingrd 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
| Source | df | SS | MS | F | p-value |
|---|---|---|---|---|---|
| Batch | 4 | 15.44 | 3.86 | 1.2345 | 0.3476 |
| Day | 4 | 12.24 | 3.06 | 0.9787 | 0.4550 |
| Ingredient | 4 | 141.44 | 35.36 | 11.3092 | 0.000488 |
| Error | 12 | 37.52 | 3.1267 |
Here since p = 0.000488 < 0.05, we reject the null hypothesis. We find that the ingredient significantly affects the mean reaction time.