Question 1
## Loading required package: carData
#Input Data
obs <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
bolt <- c(seq(1,5),seq(1,5),seq(1,5),seq(1,5))
chem <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4)
chem <- as.fixed(chem)
bolt <- as.fixed(bolt)
Ho: mu1=mu2=mu3=mu4=mu5 Ha: at least one differs Yij = mu + Ti + Bj + Ei
model <- lm(obs~chem+bolt)
gad(model)
## $anova
## Analysis of Variance Table
##
## Response: obs
## Df Sum Sq Mean Sq F value Pr(>F)
## chem 3 12.95 4.317 2.3761 0.1211
## bolt 4 157.00 39.250 21.6055 2.059e-05 ***
## Residuals 12 21.80 1.817
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Reject the Null based on a p-value based on an alpha of 0.15
Question 2
Ho: mu1=mu2=mu3=mu4=mu5 Ha: at least one differs Yij = mu + Ti + Ei
## Df Sum Sq Mean Sq F value Pr(>F)
## chem 3 12.95 4.317 0.386 0.764
## Residuals 16 178.80 11.175
Fail to reject Ho at an alpha of 0.15.
Question 3: The two tests have significantly different p-values as you cannot reject unless you block the design by the bolts. Therefore, the bolt does have a significant amount of nuisance variability. (This is supported by the p-value of the bolts outputted in question 1)
Complete Code
library(GAD)
obs <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
bolt <- c(seq(1,5),seq(1,5),seq(1,5),seq(1,5))
chem <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4)
chem <- as.fixed(chem)
bolt <- as.fixed(bolt)
model <- lm(obs~chem+bolt)
gad(model)
model <- lm(obs ~ chem)
summary(aov(model))