The effect of five different ingredients (A, B, C, D, E) on the reaction time of a chemical process is being studied. Each batch of new material is only large enough to permit five runs to be made. Furthermore, each run requires approximately 1.5 hours, so only five runs can be made in one day. The experimenter decides to run the experiment as a Latin square so that day and batch effects may be systematically controlled. She obtains the data that follows.
library(knitr)
#Create the data frame for the table
exp_dat<-data.frame(
Day1=c("A=8","B=7","D=1","C=7","E=3"),
Day2=c("B=7","E=2","A=9","C=8","D=2"),
Day3=c("D=1", "A=7", "C=10", "E=6", "B=3"),
Day4=c("C=7","D=3","E=1","B=6","A=8"),
Day5=c("E=3","B=8","D=5","A=10","C=8")
)
rownames(exp_dat)<-paste("Batch",1:5)
#display table
kable(exp_dat)
| Day1 | Day2 | Day3 | Day4 | Day5 | |
|---|---|---|---|---|---|
| Batch 1 | A=8 | B=7 | D=1 | C=7 | E=3 |
| Batch 2 | B=7 | E=2 | A=7 | D=3 | B=8 |
| Batch 3 | D=1 | A=9 | C=10 | E=1 | D=5 |
| Batch 4 | C=7 | C=8 | E=6 | B=6 | A=10 |
| Batch 5 | E=3 | D=2 | B=3 | A=8 | C=8 |
The provided table is a valid Latin square because the ingredients are not repeated in the same column or row. Each row and column is unique.
The model equation to be used for this is:
\[y_{ijk}=\mu+\tau_i+\beta_j+\gamma_k+\epsilon_{ijk}\]
Where:
\[y\_{ijk} = \text{ The reaction time for ingredient i on day j and batch k}\] \[\mu = \text{ The overall reaction time}\]
\[\tau = \text{ The effect of the i-th ingredient}\] \[\beta = \text{ The effect of the j-th day}\] \[\gamma = \text{ The effect of the k-th batch}\] \[\epsilon = \text{The random error term}\]
We will analyze the data from this experiment using \(\alpha=0.005\) level of significance.
#Load the data
dat<-data.frame(
Day=rep(1:5,each=5),
Batch=rep(1:5,times=5),
Trt=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)
)
#Factor Conversion
dat$Day<-as.factor(dat$Day)
dat$Batch<-as.factor(dat$Batch)
dat$Trt<-as.factor(dat$Trt)
#Fit model
model<-aov(Time~Trt+Day+Batch, data=dat)
#Summary
summary(model)
## Df Sum Sq Mean Sq F value Pr(>F)
## Trt 4 141.44 35.36 11.309 0.000488 ***
## Day 4 15.44 3.86 1.235 0.347618
## Batch 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
Looking at the summary of the ANOVA model, we see that the p-value for the treatment (0.000488) is much smaller than the chosen 𝛼=0.05; therefore, one of the treatments significantly affects the reaction time. The treatment factor has an impact on the chemical process time.
knitr::opts_chunk$set(echo=TRUE, warning=FALSE, message=FALSE)
library(knitr)
#Create the data frame for the table
exp_dat<-data.frame(
Day1=c("A=8","B=7","D=1","C=7","E=3"),
Day2=c("B=7","E=2","A=9","C=8","D=2"),
Day3=c("D=1", "A=7", "C=10", "E=6", "B=3"),
Day4=c("C=7","D=3","E=1","B=6","A=8"),
Day5=c("E=3","B=8","D=5","A=10","C=8")
)
rownames(exp_dat)<-paste("Batch",1:5)
#display table
kable(exp_dat)
#Load the data
dat<-data.frame(
Day=rep(1:5,each=5),
Batch=rep(1:5,times=5),
Trt=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)
)
#Factor Conversion
dat$Day<-as.factor(dat$Day)
dat$Batch<-as.factor(dat$Batch)
dat$Trt<-as.factor(dat$Trt)
#Fit model
model<-aov(Time~Trt+Day+Batch, data=dat)
#Summary
summary(model)