Q1

Hypothesis test:

Linear Effect equation: \[ y_{i,j} = \mu + \tau_i + \beta_j + \epsilon_{i,j} \] Where:

library(GAD)
ch1 <- c(73,68,74,71,67)
ch2 <- c(73,67,75,72,70)
ch3 <- c(75,68,78,73,68)
ch4 <- c(73,71,75,75,69)

blts <-c(1,2,3,4,5)

obs <- c(ch1,ch2,ch3,ch4)
chem <-c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
chem <-as.fixed(chem)
bolts <- c(rep(blts,4))
bolts <-as.fixed(bolts)

model <- lm(obs ~ chem + bolts)

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    
## bolts      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

Since our p-value is less than 0.15, we reject the H0 which means our sample populations have different means.

Q2

Hypothesis test:

Linear Effect equation: \[ y_{i,j} = \mu + \tau_i + \epsilon_{i,j} \] Where:

model <- lm(obs ~ chem)
gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: obs
##           Df Sum Sq Mean Sq F value Pr(>F)
## chem       3  12.95  4.3167  0.3863 0.7644
## Residuals 16 178.80 11.1750

Since p-value is more than our alpha we fail to reject H0.

Q3

We compared models in Q1 and Q2 and we came to this conclusion : 1- Our p-value increased significantly. 2- when we consider the bolt types in our model, nuisance variablity is reduced which leads to rejecting the H0.

code:

library(GAD)
ch1 <- c(73,68,74,71,67)
ch2 <- c(73,67,75,72,70)
ch3 <- c(75,68,78,73,68)
ch4 <- c(73,71,75,75,69)

blts <-c(1,2,3,4,5)

obs <- c(ch1,ch2,ch3,ch4)
chem <-c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
chem <-as.fixed(chem)
bolts <- c(rep(blts,4))
bolts <-as.fixed(bolts)

model <- lm(obs ~ chem + bolts)

gad(model)

model <- lm(obs ~ chem)
gad(model)