Yes, this is a valid 5 x 5 Latin Square Design because each of the five ingredients appear only once in each row and each column.
Linear effects model:
\[ y_{ijk}=\mu+\tau_i+\beta_j+\gamma_k+\epsilon_{ijk}\]
where:
\(\mu\) is the overall mean
\(\tau_i\) is the ingredient effect
\(\beta_j\) is the batch effect
\(\gamma_k\) is the day effect
\(\epsilon_{ijk}\) is the random error
Hypotheses:
\[H_0:\mu_A=\mu_B=\mu_C=\mu_D=\mu_E\]
\[H_a:\text{At least one ingredient mean differs}\]
batch<-rep(1:5,each=5)
day<-rep(1:5,5)
ingredient<-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
)
ingredient<-as.factor(ingredient)
batch<-as.factor(batch)
day<-as.factor(day)
model<-aov(obs~ingredient+batch+day)
summary(model)
## Df Sum Sq Mean Sq F value Pr(>F)
## ingredient 4 141.44 35.36 11.309 0.000488 ***
## batch 4 15.44 3.86 1.235 0.347618
## day 4 12.24 3.06 0.979 0.455014
## Residuals 12 37.52 3.13
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model)
aggregate(obs~ingredient,FUN=mean)
## ingredient obs
## 1 A 8.4
## 2 B 5.6
## 3 C 8.8
## 4 D 3.4
## 5 E 3.2
TukeyHSD(model,"ingredient")
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = obs ~ ingredient + batch + day)
##
## $ingredient
## diff lwr upr p adj
## B-A -2.8 -6.3646078 0.7646078 0.1539433
## C-A 0.4 -3.1646078 3.9646078 0.9960012
## D-A -5.0 -8.5646078 -1.4353922 0.0055862
## E-A -5.2 -8.7646078 -1.6353922 0.0041431
## C-B 3.2 -0.3646078 6.7646078 0.0864353
## D-B -2.2 -5.7646078 1.3646078 0.3365811
## E-B -2.4 -5.9646078 1.1646078 0.2631551
## D-C -5.4 -8.9646078 -1.8353922 0.0030822
## E-C -5.6 -9.1646078 -2.0353922 0.0023007
## E-D -0.2 -3.7646078 3.3646078 0.9997349
plot(TukeyHSD(model,"ingredient"))
Since the p-value (approx 0.000488) for ingredient is less than 0.05, we reject the null hypothesis. There is sufficient evidence to conclude that at least one ingredient has a different mean reaction time.
The batch and day effects are not statistically significant at the 0.05 level of significance.
Based on the Tukey HSD test, the mean reaction times of ingredients D and E are significantly different from those of ingredients A and C at the 0.05 level of significance. Ingredients D and E have lower mean reaction times than ingredients A and C. No other pairwise comparisons are statistically significant.
batch<-rep(1:5,each=5)
day<-rep(1:5,5)
ingredient<-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
)
ingredient<-as.factor(ingredient)
batch<-as.factor(batch)
day<-as.factor(day)
model<-aov(obs~ingredient+batch+day)
summary(model)
plot(model)
aggregate(obs~ingredient,FUN=mean)
TukeyHSD(model,"ingredient")
plot(TukeyHSD(model,"ingredient"))