Problem 14.3
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.
Obs <- c(12,8,14,12,14,16,9,9,15,10,10,15,11,10,13,11,12,15,12,8,14,13,11,14)
Machine <- rep(c(rep(1,2),rep(2,2),rep(3,2)),4)
Spindle <- rep(seq(1,2),12)
dat1 <- 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
plot(model)




\(\overline{y_{ijk}} = \mu+ \alpha_{i}+\beta_{j(i)}+\epsilon_{ijk}\)
\(H_{0}: \alpha_{i}=0\) for all i
\(H_{1}: \alpha_{i}\ne0\) for some i
\(H_{0}: \beta_{j(i)}=0\) for all j in i
\(H_{1}: \beta_{j(i)}\ne0\) for some j in i
Since P-value(Machine)=0.2915630>0.05, we do not reject null hypothesis, Machine does not significantly affect the means.
Since P-value(Spindle nested in Machine)=0.0004428<0.05, we do reject null hypothesis, Spindle nested in Machine does significantly affect the means.
From residual and qqnorm plot, we know that it has a slight violence on equal variance and it is roughly normal distributed.
Code display:
library(GAD)
Obs <- c(12,8,14,12,14,16,9,9,15,10,10,15,11,10,13,11,12,15,12,8,14,13,11,14)
Machine <- rep(c(rep(1,2),rep(2,2),rep(3,2)),4)
Spindle <- rep(seq(1,2),12)
dat1 <- data.frame(Machine, Spindle, Obs)
Machine <- as.fixed(Machine)
Spindle <- as.random(Spindle)
model <- lm(Obs~Machine+Spindle%in%Machine)
gad(model)
plot(model)