0.1 R Markdown

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

Ans: yes, it is avalid latin squares as it has two nuisances which are no.of days,multiple batches. we can also see that the ingredients in the data are not repeated in each rows and colomns.

2.Write the model equation?

Ans: \(Y_{ijk}= \mu +\tau_{i} +\beta _{j}+\alpha _{k}+\varepsilon_{ijk}\)

Null hypotheses = \(H_{0}:\mu_{ 1}=\mu_{ 2}=\mu_{ 3}=\mu_{ 4}=\mu_{ 5}\)

Alternative Hypotheses = At least one mu differs

3.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, be sure all blocks are recognized as factors)

Ans: #data insertion.

data<-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<-c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
days<-c(rep(seq(1,5)),seq(1,5),seq(1,5),seq(1,5),seq(1,5))
ingredients<-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")
batch<-as.factor(batch)
days<-as.factor(days)
ingredients<-as.factor(ingredients)

###making a dataframe 
data.frame(data,batch,days,ingredients)
##    data batch days ingredients
## 1     8     1    1           A
## 2     7     1    2           B
## 3     1     1    3           D
## 4     7     1    4           C
## 5     3     1    5           E
## 6    11     2    1           C
## 7     2     2    2           E
## 8     7     2    3           A
## 9     3     2    4           D
## 10    8     2    5           B
## 11    4     3    1           B
## 12    9     3    2           A
## 13   10     3    3           C
## 14    1     3    4           E
## 15    5     3    5           D
## 16    6     4    1           D
## 17    8     4    2           C
## 18    6     4    3           E
## 19    6     4    4           B
## 20   10     4    5           A
## 21    4     5    1           E
## 22    2     5    2           D
## 23    3     5    3           B
## 24    8     5    4           A
## 25    8     5    5           C
###Performing the operation
aov.model<-aov(data~batch+days+ingredients)
summary(aov.model)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## batch        4  15.44    3.86   1.235 0.347618    
## days         4  12.24    3.06   0.979 0.455014    
## ingredients  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

—>comments: here we can see the p value is 0.000488 which is very less than the alpha : 0.05 where we got to reject the null hypothesis.

#Source File:

data<-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<-c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
days<-c(rep(seq(1,5)),seq(1,5),seq(1,5),seq(1,5),seq(1,5))
ingredients<-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")
batch<-as.factor(batch)
days<-as.factor(days)
ingredients<-as.factor(ingredients)

data.frame(data,batch,days,ingredients)
aov.model<-aov(data~batch+days+ingredients)
summary(aov.model)