# Question 14.3
# Null hypothesis(H0) : alpha_i = 0 for all i
# Alternative hypothesis(Ha) : alpha_i != 0 for some i
# NULL hypothesis(H0) : sigma^2*beta_j = 0 for all j
# Alternative hypothesis(Ha) : sigma^2*beta_j != 0 for some j
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<- c(rep(1,8),rep(2,8),rep(3,8))
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)
data <- data.frame(machine,spindle,obs)
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
# As from the result This is significant as p value = 0.0004428 of the nested factor is less than alpha = 0.05