Blocking

A chemist wishes to test the effect of four chemical agents on the strength of a particular type of cloth. Because there might be variability from one bolt to another, the chemist decides to use a randomized block design, with the bolts of cloth considered as blocks. She selects five bolts and applies all four chemicals in random order to each bolt.

The linear effects model to be used is: \[Y_{ij}=\mu + \tau_i + \beta_j + \epsilon_{ij}\]

Where: \[Y_{ij} = \text{ the observed tensile strength for chemical i on bolt j}\] \[\mu = \text{ overall mean of tensile strenght}\] \[\tau_i = \text{ the fixed effect of chemical agent i}\] \[\beta_j=\text{ the random effect of bolt j}\] \[\epsilon_{ij}=\text{ the random error}\] The hypothesis that will be tested for a fixed effect of chemical agent is, that all chemicals have the same effect: \[H_0:\tau_1=\tau_2=\tau_3=\tau_4=0\] \[H_a:\text{ at least one }\tau_i\neq 0\]

Load the Data

We begin with loading the data in.

library(GAD)

#Bring in the data
bolt<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
#Bolt is the random effect
bolt<-as.random(bolt)
chemical<-c(seq(1,4),seq(1,4),seq(1,4),seq(1,4))
#chemical is the fixed effect
chemical<-as.fixed(chemical)
#input strength observations
strength<-c(
  73,68,74,71,
  73,67,75,72,
  75,68,78,73,
  73,71,75,75
  )

We brought in the data and set the chemical as a fixed effect because we care about the single treatments. The bolt is set as a random effect because bolts are sampled from a population and may vary.

We now take that data and fit it to a linear model, and run GAD on it:

model<-lm(strength~chemical+bolt)
gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: strength
##           Df  Sum Sq Mean Sq F value    Pr(>F)    
## chemical   3 104.187  34.729 20.0843 0.0002515 ***
## bolt       3  14.187   4.729  2.7349 0.1057217    
## Residuals  9  15.563   1.729                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Using \(\alpha=0.15\), we see that the p-value for the chemical is less than \(\alpha\); therefore, there is a significant difference in the chemical effects. Since the p-value for the bolt is also below \(\alpha\), the blocking was effective and necessary.

If we plot the model, we can verify the GAD output. The Q-Q plot shows that the data does not appear to be normally distributed and is spread.

plot(model,2)

The scale-location plot shows a red line that is not flat, indicating a non-constant variance.

plot(model,3)

No Blocking

Now lets look at the scenario that the chemist did not block on the bolt and ratherran the experiment at a completely randomized design on random pieces of cloth. We will analyze the new data using \(\alpha=0.15\).

The linear effects model to be used is: \[Y_{ij}=\mu + \tau_i + \epsilon_{ij}\]

Where: \[Y_{ij} = \text{ the observed tensile strength for chemical i in replication j}\] \[\mu = \text{ overall mean of tensile strenght}\] \[\tau_i = \text{ the fixed effect of chemical agent i}\] \[\epsilon_{ij}=\text{ the random error}\] The hypothesis that will be that all chemicals have the same mean effect: \[H_0:\tau_1=\tau_2=\tau_3=\tau_4=0\] \[H_a:\text{ at least one }\tau_i\neq 0\]

Load the Data

We begin with loading the data in.

strength2<-c(
  73,68,74,71,
  73,67,75,72,
  75,68,78,73,
  73,71,75,75
)

chemical2<-factor(rep(1:4, each=4))
#Chemical is fixed effect
chemical2<-as.fixed(chemical2)

We now take that data and fit it to a linear model, and run GAD on it:

model2<-lm(strength2~chemical2)
gad(model2)
## $anova
## Analysis of Variance Table
## 
## Response: strength2
##           Df  Sum Sq Mean Sq F value Pr(>F)
## chemical2  3  14.187  4.7292  0.4739 0.7062
## Residuals 12 119.750  9.9792

From the GAD output and using an \(\alpha=0.15\), we can see that the chemical p-value is greater than \(\alpha\), therefore we fail to reject the null hypothesis due to no significant difference is detected.

If we plot the model, we can verify the GAD output. The Q-Q plot shows that the data does not appear to be have normality and is spread, especially at the left tail.

plot(model2,2)

However, if we plot the scale-location of the model, we get a relatively flat red line, indicating the data has a constant variance.

plot(model2,3)

Conclusion

Comparing scenario 1, blocking, to scenario 2, no blocking, we can see some differences. In scenario 1, we see that the chemical had a significant difference and that the blocking was necessary due to the p-values that we obtained. Since the p-value for the bolt was below the chosen \(\alpha\), we can conclude that the bolts differ in their strengths and are a nuisance variability.

For scenario 2, the variance in the data does not show and is absorbed into the error. This can possibly hide the treatment effects and hide the variance.

In conclusion, the bolt is a significant source of nuisance variability and the blocking was effective in improving the the precision of the analysis.

knitr::opts_chunk$set(echo=TRUE, warning=FALSE, message=FALSE)
library(GAD)

#Bring in the data
bolt<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
#Bolt is the random effect
bolt<-as.random(bolt)
chemical<-c(seq(1,4),seq(1,4),seq(1,4),seq(1,4))
#chemical is the fixed effect
chemical<-as.fixed(chemical)
#input strength observations
strength<-c(
  73,68,74,71,
  73,67,75,72,
  75,68,78,73,
  73,71,75,75
  )

model<-lm(strength~chemical+bolt)
gad(model)
plot(model,2)
plot(model,3)
strength2<-c(
  73,68,74,71,
  73,67,75,72,
  75,68,78,73,
  73,71,75,75
)

chemical2<-factor(rep(1:4, each=4))
#Chemical is fixed effect
chemical2<-as.fixed(chemical2)

model2<-lm(strength2~chemical2)
gad(model2)
plot(model2,2)
plot(model2,3)