Problem 1

\(Y_{ijkl}= \mu + \alpha_i + \beta_j + \gamma_k + (\alpha\beta)_{ij} + (\alpha\gamma)_{ik} + (\beta\gamma)_{jk} + (\alpha\beta\gamma)_{ijk} + \varepsilon_{ijkl}\)

\(Y_{ijkl}\): Powder Density

\(\mu\): grand average

\(\alpha_i\): Ammonium effect

\(\beta_j\): Stir Rate effect

\(\gamma_k\):temperature effect

\((\alpha\beta)_{ij}\): ammonium and stir rate interaction

\((\alpha\gamma)_{ik}\): ammonium and temperature interaction

\((\beta\gamma)_{jk}\):stir rate and temperature interaction

\((\alpha\beta\gamma)_{ijk}\): interaction between 3 factors

\(\varepsilon_{ijkl}\):random error

\[ i, j , k = 1,2 , \qquad l = 1,2 ,\qquad \varepsilon_{ijkl} \sim N(0 , \sigma^2) \]

library(GAD)

Ammonium<-c(2,2,30,30,2,2,30,30,2,2,30,30,2,2,30,30)

StirRate<-c(100,100,100,100,150,150,150,150,100,100,100,100,150,150,150,150)

Temperature<-c(8,8,8,8,8,8,8,8,40,40,40,40,40,40,40,40)

Density<-c(14.68,15.18,15.12,17.48,7.54,6.66,12.46,12.62,10.95,17.68,12.65,15.96,8.03,8.84,14.96,14.96)
           
Ammonium<-as.fixed(Ammonium)
StirRate<-as.fixed(StirRate)
Temperature<-as.fixed(Temperature)

model1<-aov(Density~Ammonium*StirRate*Temperature)
GAD::gad(model1)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                               Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammonium                       1 44.389  44.389 11.1803 0.010175 * 
## StirRate                       1 70.686  70.686 17.8037 0.002918 **
## Temperature                    1  0.328   0.328  0.0826 0.781170   
## Ammonium:StirRate              1 28.117  28.117  7.0817 0.028754 * 
## Ammonium:Temperature           1  0.022   0.022  0.0055 0.942808   
## StirRate:Temperature           1 10.128  10.128  2.5510 0.148890   
## Ammonium:StirRate:Temperature  1  1.519   1.519  0.3826 0.553412   
## Residuals                      8 31.762   3.970                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

In the full model, Ammonium, Stir Rate and Ammonium * Stir Rate interaction are significant because their p-value is less than alpha=0.05.

The Ammonium *Stir Rate * Temperature interaction is not significant because p-value= 0.553412 < alpha=0.05. It will be removed from the model.

model2<-aov(Density~Ammonium + StirRate + Temperature + Ammonium:StirRate + Ammonium:Temperature + StirRate:Temperature)

GAD::gad(model2)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                      Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammonium              1 44.389  44.389 12.0037 0.007109 **
## StirRate              1 70.686  70.686 19.1150 0.001792 **
## Temperature           1  0.328   0.328  0.0886 0.772681   
## Ammonium:StirRate     1 28.117  28.117  7.6033 0.022206 * 
## Ammonium:Temperature  1  0.022   0.022  0.0059 0.940538   
## StirRate:Temperature  1 10.128  10.128  2.7389 0.132317   
## Residuals             9 33.281   3.698                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Ammonium, Stir Rate and Ammonium * Stir Rate are significant because their p-values are less than alpha= 0.05.

Temperature, Ammonium * Temperature and Stir Rate * Temperature are not significant because their p-values are greater than alpha=0.05.

The Ammonium * Temperature interaction will be removed because it is not significant and has the largest p-value= 0.940538.

model3<-aov(Density~Ammonium + StirRate + Temperature + Ammonium:StirRate  + StirRate:Temperature)

GAD::gad(model3)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                      Df Sum Sq Mean Sq F value    Pr(>F)    
## Ammonium              1 44.389  44.389 13.3287 0.0044560 ** 
## StirRate              1 70.686  70.686 21.2250 0.0009696 ***
## Temperature           1  0.328   0.328  0.0984 0.7601850    
## Ammonium:StirRate     1 28.117  28.117  8.4426 0.0156821 *  
## StirRate:Temperature  1 10.128  10.128  3.0412 0.1117751    
## Residuals            10 33.303   3.330                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Ammonium, Stir Rate and Ammonium * Stir Rate are significant because their p-value is less than alpha= 0.05.

Temperature and Stir Rate * Temperature are not significant because their p-value is greater than alpha=0.05.

The Stir Rate * Temperature interaction will be removed because it is not significant and has p-value of 0.111775, which is greater than alpha=0.05.

model4<-aov(Density~Ammonium + StirRate + Temperature + Ammonium:StirRate )

GAD::gad(model4)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                   Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammonium           1 44.389  44.389 11.2425 0.006443 **
## StirRate           1 70.686  70.686 17.9028 0.001410 **
## Temperature        1  0.328   0.328  0.0830 0.778613   
## Ammonium:StirRate  1 28.117  28.117  7.1211 0.021851 * 
## Residuals         11 43.431   3.948                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Ammonium, Stir Rate and Ammonium * Stir Rate are significant because their p-values are less than alpha=0.05.

Temperature is not significant because p-value= 0.778613 > alpha=0.05.

The Temperature will be removed because it is not significant and the p-value=0.778613 > alpha=0.05.

model5<-aov(Density~Ammonium + StirRate + Ammonium*StirRate )

GAD::gad(model5)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                   Df Sum Sq Mean Sq F value    Pr(>F)    
## Ammonium           1 44.389  44.389 12.1727 0.0044721 ** 
## StirRate           1 70.686  70.686 19.3841 0.0008612 ***
## Ammonium:StirRate  1 28.117  28.117  7.7103 0.0167511 *  
## Residuals         12 43.759   3.647                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Ammonium, Stir Rate and Ammonium * Stir Rate are significant because their p-value is greater than alpha=0.05 .

This is the final model.

The interaction plot:

interaction.plot(x.factor=StirRate,trace.factor = Ammonium,response = Density
                 , xlab=" Stir Rate (RPM)", ylab = "Mean Density", trace.label = "Ammonium(%)", type="b")

The lines are not parallel. Showing that the effect of Stir Rate on density depends on the Ammonium level.

Problem 2

library(agricolae)

design<- design.ab(c(2,2,2),r=3,design="rcbd",seed= 45665)
design$book
##    plots block A B C
## 1    101     1 1 2 1
## 2    102     1 1 1 2
## 3    103     1 2 2 1
## 4    104     1 2 2 2
## 5    105     1 1 2 2
## 6    106     1 2 1 1
## 7    107     1 1 1 1
## 8    108     1 2 1 2
## 9    109     2 1 2 1
## 10   110     2 2 1 2
## 11   111     2 1 1 1
## 12   112     2 2 2 2
## 13   113     2 1 2 2
## 14   114     2 2 1 1
## 15   115     2 1 1 2
## 16   116     2 2 2 1
## 17   117     3 2 1 2
## 18   118     3 1 2 2
## 19   119     3 2 2 2
## 20   120     3 2 1 1
## 21   121     3 2 2 1
## 22   122     3 1 1 2
## 23   123     3 1 1 1
## 24   124     3 1 2 1