Q1. Is this a valid Latin Square? (explain)

Ans: Yes.This is a valid Latin Square. Because none of the factors have been replicated in either indentical column or row.

————————————————————————————————

Q2. Write the model equation

\(\overline{y_{ijk}}=\mu+\tau_{i}+\beta_{j}+\alpha_{k}+\epsilon_{ijk}\)

\(\mu\): Grand mean. \(\tau_{i}\): Treatment. \(\beta_{j}\): Block 1. \(\alpha_{k}\): Block 2. \(\epsilon_{ijk}\): Random error.

————————————————————————————————

Q3. Analyze the data from this experiment (use α=0.05) and draw conclusions about the factor of interest. (Note: Use aov() instead of gad() for Latin Square Designs)

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)
trt <- 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)
block1 <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
block2 <- c(rep(seq(1,5),5))
dat1 <- cbind(obs,trt,block1,block2)
dat1 <- as.data.frame(dat1)
str(dat1)
## 'data.frame':    25 obs. of  4 variables:
##  $ obs   : num  8 7 1 7 3 11 2 7 3 8 ...
##  $ trt   : num  1 2 4 3 5 3 5 1 4 2 ...
##  $ block1: num  1 1 1 1 1 2 2 2 2 2 ...
##  $ block2: num  1 2 3 4 5 1 2 3 4 5 ...
dat1$trt<-as.factor(dat1$trt)
dat1$block1<-as.factor(dat1$block1)
dat1$block2<-as.factor(dat1$block2)
str(dat1)
## 'data.frame':    25 obs. of  4 variables:
##  $ obs   : num  8 7 1 7 3 11 2 7 3 8 ...
##  $ trt   : Factor w/ 5 levels "1","2","3","4",..: 1 2 4 3 5 3 5 1 4 2 ...
##  $ block1: Factor w/ 5 levels "1","2","3","4",..: 1 1 1 1 1 2 2 2 2 2 ...
##  $ block2: Factor w/ 5 levels "1","2","3","4",..: 1 2 3 4 5 1 2 3 4 5 ...

\(\tau_{i}=0\) null hypothesis: \(H_0: \mu_{1}=\mu_{2}=\cdots =\mu_{i}=\mu\)

\(\tau_{i}\ne 0\) alternative hypothesis: \(H_1:\) at least one \(\mu_{i}\) differs

aov.model<-aov(obs~trt+block1+block2, data = dat1)
summary(aov.model)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## trt          4 141.44   35.36  11.309 0.000488 ***
## block1       4  15.44    3.86   1.235 0.347618    
## block2       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(aov.model)

boxplot(obs~trt,xlab="type/method",ylab="observation",main="Boxplot of Observations")

Ans: Since p-value=0.000488<0.05, we do reject the null hypothesis (i.e., at least one means differs). The factor of interest here is ingredients, batch and day are recognized as blocks, which are nuisance and not the subjects we are studing on.

Dr. Matis said we treat this case as only an example to practice Latin Square, Assumption checks are therefore ignored herein.

————————————————————————————————

Raw Code:

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)
trt <- 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)
block1 <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
block2 <- c(rep(seq(1,5),5))
dat1 <- cbind(obs,trt,block1,block2)
dat1 <- as.data.frame(dat1)
str(dat1)
dat1$trt<-as.factor(dat1$trt)
dat1$block1<-as.factor(dat1$block1)
dat1$block2<-as.factor(dat1$block2)
str(dat1)
aov.model<-aov(obs~trt+block1+block2, data = dat1)
summary(aov.model)
plot(aov.model)
boxplot(obs~trt,xlab="type/method",ylab="observation",main="Boxplot of Observations")