Nested Designs using R

Getting the data

library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
process <- rep(c(rep(1,4),rep(2,4),rep(3,4)),3)
batch <- rep(rep(seq(1,4),3),3)
obs <- c(rep(1,12),rep(2,12),rep(3,12))

rate <- c(25,19,15,15,19,23,18,35,14,35,38,25,
          30,28,17,16,17,24,21,27,15,21,54,29,
          26,20,14,13,14,21,17,25,20,24,50,33)

data <- data.frame(process,batch,obs,rate)

data$process <- as.fixed(data$process)
data$batch <- as.random(data$batch)

Equation and Hyphotesis

For this particular problem, we want to test if the process are different:

\[ H_o: \alpha_i = 0\\ H_a: \alpha_i \neq 0 \]

And the model equation will be as follows:

\[ y_{ijk} = \mu+\alpha_i+\beta_{j(i)}+\epsilon_{ijk} \]

Testing the data

model.aov <- lm(rate~batch+process%in%process,data=data)
gad(model.aov)
## Analysis of Variance Table
## 
## Response: rate
##          Df  Sum Sq Mean Sq F value Pr(>F)  
## batch     3  230.31   76.77  1.0008  0.406  
## process   2  676.06  338.03  4.4066  0.021 *
## Residual 30 2301.28   76.71                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Conclusion

Since the Process p-value (\(p-value=0.021\)) is lesser than \(\alpha = 0.05\), we can reject Ho and consider that there is a difference between the processes.