Question-14.3
# (H0) : alpha_i = 0 for all i
# (Ha) : alpha_i != 0 for some i
# (H0) : sigma^2*beta_j = 0 for all j
# (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.
m <- c(rep(1,8),rep(2,8),rep(3,8))
s <- rep(c(rep(1,4),rep(2,4)),3)
resp <- 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)
dat <- data.frame(m,s,resp)
m <- as.fixed(m)
s <- as.random(s)
model <- lm(resp~m+s%in%m)
gad(model)
## Analysis of Variance Table
##
## Response: resp
## Df Sum Sq Mean Sq F value Pr(>F)
## m 2 55.75 27.8750 1.9114 0.2915630
## m:s 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 for nested factor “s” is less than alpha(0.05).This it is significant.