library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.

1)

With Blocking:

The linear effects model is :

\[ y_{i,j} = \mu + \tau_{i} + \beta_{j} + \epsilon_{ij} \]Hypothesis we are testing is:

Null Hypothesis:

\[ H_{0} : \mu 1 = \mu_{2} = \mu_{3} = \mu_{4} = \mu \]

Alternate Hypothesis :

Atleast one \(\mu_{i}\) differ

\(\mu\) = grand mean

\(\tau_{i}\) = Fixed Effects for treatment ‘i’.

\(\beta_{j}\) = Blocked Effects for ‘j’

\(\epsilon_{ij}\) = Random error

Scanning and manipulating the data

dat <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
chem <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
chem <- as.fixed(chem)
bolts <- c(rep(seq(1,5),4))
bolts <- as.fixed(bolts)

Performing linear model with blocking

model1 <- lm(dat~chem+bolts)
gad(model1)
## Analysis of Variance Table
## 
## Response: dat
##          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 ***
## Residual 12  21.80   1.817                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

By Blocking we can see that the P value is 0.1211 < 0.15($\alpha$). So, we reject Null Hypothesis that all the means are equal and conclude that atleast one mean differs.

2)

Without Blocking:

The linear effects model is :

\[ y_{i,j} = \mu + \tau_{i} + \epsilon_{ij} \]Hypothesis we are testing is:

Null Hypothesis:

\[ H_{0} : \mu 1 = \mu_{2} = \mu_{3} = \mu_{4} = \mu \]

Alternate Hypothesis :

Atleast one \(\mu_{i}\) differ

\(\mu\) = grand mean

\(\tau_{i}\) = Fixed Effects for treatment ‘i’.9

\(\epsilon_{ij}\) = Random error

Performing linear model without blocking

model1 <- lm(dat~chem)
gad(model1)
## Analysis of Variance Table
## 
## Response: dat
##          Df Sum Sq Mean Sq F value Pr(>F)
## chem      3  12.95  4.3167  0.3863 0.7644
## Residual 16 178.80 11.1750

Without blocking we got the p value as 0.7644 > 0.15($\alpha$). So we fail to reject null hypothesis and conclude that all the means are equal.

3)

With Blocking we can see that the P value is 0.1211 < 0.15($\alpha$). Without blocking we got the p value as 0.7644 > 0.15($\alpha$). By comparing blocked and non blocked cases we can see that bolt of cloth represents a significant amount of nuisance variability in blocked case.

source code :

library(GAD)
#1
dat <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
chem <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
chem <- as.fixed(chem)
bolts <- c(rep(seq(1,5),4))
bolts <- as.fixed(bolts)

model1 <- lm(dat~chem+bolts)
gad(model1)

#2
model1 <- lm(dat~chem)
gad(model1)