Problem 1

(a)

Let \(A\) = ammonium, \(B\) = stir rate, and \(C\) = temperature.

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

Here \(i,j,k=1,2\) and \(l=1,2\)

(b)

pwdr <- data.frame(
  A = factor(c(2,2,30,30,2,2,30,30,2,2,30,30,2,2,30,30)),
  B = factor(c(100,100,100,100,150,150,150,150,100,100,
               100,100,150,150,150,150)),
  C = factor(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)
)
full <- aov(density ~ A *B *C, data = pwdr)
summary(full)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## A            1  44.39   44.39  11.180 0.01018 * 
## B            1  70.69   70.69  17.804 0.00292 **
## C            1   0.33    0.33   0.083 0.78117   
## A:B          1  28.12   28.12   7.082 0.02875 * 
## A:C          1   0.02    0.02   0.005 0.94281   
## B:C          1  10.13   10.13   2.551 0.14889   
## A:B:C        1   1.52    1.52   0.383 0.55341   
## Residuals    8  31.76    3.97                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

At \(\alpha=0.05\), the full model shows significant effects for \(A\) (\(p=0.0102\)), \(B\) (\(p=0.0029\)), and \(AB\) (\(p=0.0288\)).

The other effects are not significant: \(C\) (\(p=0.7812\)), \(AC\) (\(p=0.9428\)), \(BC\) (\(p=0.1489\)), and \(ABC\) (\(p=0.5534\)).

Firt remove \(ABC\) , then remove \(AC\), \(BC\), and \(C\).

We remove then as their p-values at removal are 0.5534, 0.9405, 0.1118, and 0.7786, respectively, which are larger that 0.05

We keep \(A\) and \(B\) because they are significant.

step1 <- aov(density ~ A*B + A*C + B*C, data = pwdr)
step2 <- aov(density ~ A*B + B*C, data = pwdr)
step3 <- aov(density ~ A*B + C, data = pwdr)
final <- aov(density ~ A*B, data = pwdr)
summary(final)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## A            1  44.39   44.39   12.17 0.004472 ** 
## B            1  70.69   70.69   19.38 0.000861 ***
## A:B          1  28.12   28.12    7.71 0.016751 *  
## Residuals   12  43.76    3.65                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The final model is

\[Y_{ijkl}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+\varepsilon_{ijkl}.\]

Final p-values are:

ammonium = 0.00447

stir rate = 0.000861

ammonium × stir rate = 0.01675.

interaction.plot(pwdr$A, pwdr$B, pwdr$density,
                 xlab = "Ammonium (%)", ylab = "Mean density",
                 trace.label = "stir rate (RPM)",
                 type = "b", col = c("blue","red"))

Here the nonparallel lines show the interaction. We see that icreasing ammonium from 2% to 30% increases themean density by 0.685 at 100 RPM and by 5.9825 at 150 RPM, averaging over temperature.

Hence, ammonium’s effect depends on stir rate.

Problem 2

Use a \(2^3\) factorial RCBD with three blocks: \(8\times3=24\) experimental units. Each block contains all eight treatments in random order. The chosen seed is 418725.

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