# install.packages("GAD") 
library(GAD)

Part 1 — RCBD (Bolt = block, random)

Model

\(y_{ij} = \mu + \alpha_i + \beta_j + \varepsilon_{ij}\)

the 4 chemicals are fixed, and the bolts are random.
checking if the chemicals change the average cloth strength.
α = 0.15.

# data by bolt (4 bolts x 4 chemicals)
bolt <- c(rep(1,4), rep(2,4), rep(3,4), rep(4,4))
chemical <- c(rep(1:4, times=4))
strength <- c(73,68,74,71,
              73,67,75,72,
              75,68,78,73,
              73,71,75,75)

# set chemical fixed, bolt random 
chemical <- as.fixed(chemical)
bolt <- as.random(bolt)

# run RCBD ANOVA
model_rcbd <- lm(strength ~ chemical + bolt)
gad(model_rcbd)
## $anova
## Analysis of Variance Table
## 
## Response: strength
##           Df  Sum Sq Mean Sq F value    Pr(>F)    
## chemical   3 104.187  34.729 20.0843 0.0002515 ***
## bolt       3  14.187   4.729  2.7349 0.1057217    
## Residuals  9  15.563   1.729                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Notes:
- Chemical F ≈ 20.08 and p ≈ 0.00025 → reject H₀ at α = 0.15.
- Bolt F ≈ 2.73 and p ≈ 0.106 → bolt is also significant at α = 0.15.
- Residual MS ≈ 1.73.

That means the chemicals have a clear effect, and there’s also some variation between bolts.


Part 2 — CRD (no blocks)

Model

\(y_{ij} = \mu + \alpha_i + \varepsilon_{ij}\)

testing the chemical effect like it was a regular completely randomized design.

chemical_crd <- as.fixed(chemical)
model_crd <- lm(strength ~ chemical_crd)
gad(model_crd)
## $anova
## Analysis of Variance Table
## 
## Response: strength
##              Df Sum Sq Mean Sq F value    Pr(>F)    
## chemical_crd  3 104.19  34.729  14.008 0.0003168 ***
## Residuals    12  29.75   2.479                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Notes:
- Chemical F ≈ 14.01 and p ≈ 0.00032 → reject H₀ at α = 0.15.
- Residual MS ≈ 2.48, which is bigger than the RCBD model.

So the chemical effect is still significant, but the error is higher when I don’t block.


Both the RCBD and CRD show that the chemicals change the cloth strength, but RCBD did a better job since it took bolt differences into account.

In the RCBD, the bolt term was significant (p ≈ 0.106), so using blocks helped remove some of that extra variation. That’s why the residual mean square is smaller (1.73 vs 2.48), and the F value for chemical is bigger (20.08 vs 14.01).

Conclusion

At α = 0.15, the chemicals have a real effect on cloth strength.
Bolt adds noticeable random variability, so blocking was worth it.
RCBD gives more precise results and should be used for this experiment.