# Null Hypothesis (H0) : alpha_i = 0 for all i
# Alternate Hypothesis (Ha) : alpha_i != 0 for some i
# Null Hypothesis (H0) : sigma^2*beta_j = 0 for all j
# Alternate Hypothesis (Ha) : sigma^2*beta_j != 0 for some j
machine <- c(rep(1,8),rep(2,8),rep(3,8))
machine
## [1] 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3
spindle <- rep(c(rep(1,4),rep(2,4)),3)
obs <- c(12,9,11,12,8,9,10,8,14,15,13,14,12,10,11,13,14,10,12,11,16,15,15,14)
library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.1 (2020-08-26 16:20:06 UTC) successfully loaded. See ?R.methodsS3 for help.
machine <- as.fixed(machine)
spindle <- as.random(spindle)
model <- lm(obs~machine+spindle%in%machine)
gad(model)
## Analysis of Variance Table
##
## Response: obs
## Df Sum Sq Mean Sq F value Pr(>F)
## machine 2 55.75 27.8750 1.9114 0.2915630
## machine:spindle 3 43.75 14.5833 9.9057 0.0004428 ***
## Residual 18 26.50 1.4722
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# p- value is 0.0004428 of nested factor(spindle) is less than alpha(0.05). Therefore, it is significant.