The model equation is:
Yijk =μ + αi + βj(i) + εijk
μ = grand mean αi = Higher level Factor (Process)
βj(i) = Lower level Factor (Batch)
εijk = error
Null Hypothesis, Ho: αi = 0
βj(i) = 0
Alternative hypothesis, Ha: αi ≠ 0
βj(i) ≠ 0
Entering the data:
library(GAD)
## Warning: package 'GAD' was built under R version 4.1.3
## Loading required package: matrixStats
## Warning: package 'matrixStats' was built under R version 4.1.3
## Loading required package: R.methodsS3
## Warning: package 'R.methodsS3' was built under R version 4.1.3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
process <- c(rep(1,12), rep(2,12), rep(3,12))
batch <- rep(c(rep(1,3), rep(2,3), rep(3,3), rep(4,3)), 3)
observation <- c(25,30,26, 19,28,20,15,17,14,15,16,13,
19,17,14,23,24,21,18,21,17,35,27,25,
14,15,20,35,21,24,38,54,50,25,29,33)
data <- data.frame(process, batch, observation)
str(data)
## 'data.frame': 36 obs. of 3 variables:
## $ process : num 1 1 1 1 1 1 1 1 1 1 ...
## $ batch : num 1 1 1 2 2 2 3 3 3 4 ...
## $ observation: num 25 30 26 19 28 20 15 17 14 15 ...
data$process <- as.fixed(data$process)
data$batch <- as.random(data$batch)
We now generate our linear model and check the gad summary
model <- lm(observation~process+batch%in%process, data = data)
gad(model)
## Analysis of Variance Table
##
## Response: observation
## Df Sum Sq Mean Sq F value Pr(>F)
## process 2 676.06 338.03 1.4643 0.2815
## process:batch 9 2077.58 230.84 12.2031 5.477e-07 ***
## Residual 24 454.00 18.92
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From the output table we see that the process is not significant since the P-value is larger than our cirtical p-value of 0.05. But the batch nested in the process is significant with p-value << 0.05. So we reject the null hypothesis for the nested lower level factor. Thus the lower level factor (batch nested in process is significant).