library(GAD)

cloth <- data.frame(
  chem = rep(1:4, each = 5),
  bolt = rep(1:5, times = 4),
  strength = c(73, 68, 74, 71, 67, 73, 67, 75, 72, 70, 75, 68, 78, 73, 68, 73, 71, 75, 75, 69)
)

cloth$chem <- as.fixed(cloth$chem)
cloth$bolt <- as.random(cloth$bolt)

Question 1

Chemical is fixed while the bolt is random as the it represent a larger population.

The linear effects model is:

\[Y_{ij} = \mu + \alpha_i + \beta_j + \epsilon_{ij}.\]

Here, \(\mu\) is the overall mean, \(\alpha_i\) is the chemical effect, \(\beta_j\) is the random bolt effect, and \(\epsilon_{ij}\) is error.

For chemical:

\[H_0: \mu_1=\mu_2=\mu_3=\mu_4\] \[H_a: \text{At least one of the chemical mean is different.}\]

For bolt:

\[H_0: \sigma_\beta^2=0\] \[H_a: \sigma_\beta^2>0\]

model_1 <- aov(strength ~ chem + bolt, data = cloth)
gad(model_1)
## $anova
## Analysis of Variance Table
## 
## Response: strength
##           Df Sum Sq Mean Sq F value    Pr(>F)    
## chem       3  12.95   4.317  2.3761    0.1211    
## bolt       4 157.00  39.250 21.6055 2.059e-05 ***
## Residuals 12  21.80   1.817                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

When \(\alpha=0.15\), we reject the null hypothesis as \(p=0.1211<0.15\).

We find that atleast one chemical mean is different.

We also find that the bolt variation is significant.

Question 2

The linear effects model is

\[Y_{ij} = \mu + \alpha_i + \epsilon_{ij}.\]

Here, \(\mu\) is the overall mean, \(\alpha_i\) is the fixed chemical effect, and \(\epsilon_{ij}\) is the error.

\[H_0: \mu_1=\mu_2=\mu_3=\mu_4\] \[H_a: \text{At least one chemical mean differs.}\]

model_2 <- aov(strength ~ chem, data = cloth)
gad(model_2)
## $anova
## Analysis of Variance Table
## 
## Response: strength
##           Df Sum Sq Mean Sq F value Pr(>F)
## chem       3  12.95  4.3167  0.3863 0.7644
## Residuals 16 178.80 11.1750

Since 0.7644 > 0.15, we do not reject \(H_0\).

Question 3

We find that the chemical effect is significant with blocking. Without blocking we find that the chemical effect is not significant it.

Also blocking lowers the error mean square from 11.1750 to 1.8167.