It is a valid Latin square because it has 2 sources of nuisance variability which are number of days and the batch effect, which are known and controllable. Also, we can conclude that the observations are not repeated in each rows and column.
That Proves Orthognoality to the experiment.
\[Y_{ijk} = \mu + \alpha_i + \beta_j + \tau_k + \epsilon_{ijk}\] where
\(Y_{ijk}\) = observed reaction time \(\mu\) = overall mean \(\alpha_i\) = batch effect \(\beta_j\) = day effect \(\tau_k\) = ingredient effect \(\epsilon_{ijk}\) = random error
reaction <- 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 <- factor(rep(1:5, each=5))
day <- factor(rep(1:5, times=5))
Ingredient <- c(1,2,4,3,5,3,5,1,4,2,2,1,3,5,4,4,3,5,2,1,5,4,2,1,3)
Batch <- as.factor(batch)
Day <- as.factor(day)
Ingredient <- as.factor(Ingredient)
Data <- data.frame(reaction , Batch , Day, Ingredient)
str(Data)
## 'data.frame': 25 obs. of 4 variables:
## $ reaction : num 8 7 1 7 3 11 2 7 3 8 ...
## $ Batch : Factor w/ 5 levels "1","2","3","4",..: 1 1 1 1 1 2 2 2 2 2 ...
## $ Day : Factor w/ 5 levels "1","2","3","4",..: 1 2 3 4 5 1 2 3 4 5 ...
## $ Ingredient: Factor w/ 5 levels "1","2","3","4",..: 1 2 4 3 5 3 5 1 4 2 ...
The Hypothesis:
Null: \[H_0: \gamma = 0\\ H_a: \gamma \ne 0\]
aov.model <- aov(reaction~Ingredient+Batch+Day,data=Data)
summary(aov.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
Since our Ingredients P-value is 0.000488, very small compared to the
sig level of 0.05, therefore we will reject the Null Hypothesis, and
conclude that different ingredients have certain effect on reaction time
of a chemical process.
Rcode
reaction <- 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 <- factor(rep(1:5, each=5))
day <- factor(rep(1:5, times=5))
Ingredient <- c(1,2,4,3,5,3,5,1,4,2,2,1,3,5,4,4,3,5,2,1,5,4,2,1,3)
Batch <- as.factor(batch)
Day <- as.factor(day)
Ingredient <- as.factor(Ingredient)
Data <- data.frame(reaction , Batch , Day, Ingredient)
str(Data)
## 'data.frame': 25 obs. of 4 variables:
## $ reaction : num 8 7 1 7 3 11 2 7 3 8 ...
## $ Batch : Factor w/ 5 levels "1","2","3","4",..: 1 1 1 1 1 2 2 2 2 2 ...
## $ Day : Factor w/ 5 levels "1","2","3","4",..: 1 2 3 4 5 1 2 3 4 5 ...
## $ Ingredient: Factor w/ 5 levels "1","2","3","4",..: 1 2 4 3 5 3 5 1 4 2 ...
aov.model <- aov(reaction~Ingredient+Batch+Day,data=Data)
summary(aov.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