1 Package Installs

#install.packages("GAD")
library(GAD)

2 Problem 1

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 resulting tensile strengths follow. Analyze the data from this experiment (use α=0.15) and draw appropriate conclusions. Be sure to state the linear effects model and hypotheses being tested. (Note: Consider whether the block (Bolt) is a fixed or random effect when performing your analysis).

First, the data needs to be put into a data frame to analyze. The code chunk below puts the data into a data frame.

chemical<-c(rep(1, 5), rep(2, 5), rep(3, 5), rep(4, 5))
bolt<-c(seq(1, 5), seq(1, 5), seq(1, 5), seq(1, 5))
obs<-c(73, 68, 74, 71, 67, 73, 67, 75, 72, 70, 75, 68, 78, 73, 68, 73, 71, 75, 75, 69)
chemical<-as.fixed(chemical)
bolt<-as.fixed(bolt)
dat<-data.frame(chemical, bolt, obs)

The linear effects equation for a randomized complete block design has four variables that have an impact on the response. These four variables are the grand mean, the effect of the individual population, the effect of the block the observation was made under, and the random error associated with the measurement. A more concise way to express this is in the equation below.

\[ x_{ij}=\mu+\tau_i+\beta_j+\epsilon_{ij} \]

For a randomized complete block design, there are two hypotheses being tested. The primary interest is whether or not there is a difference in the means of the four different chemicals. The null hypothesis for this would be that \(H_o:\tau_i=0\) for all i populations while the alternative hypothesis would be that \(H_1:\tau_i\neq0\) for at least one of the i populations. Additionally, a secondary hypothesis must be proposed to determine whether or not the blocking of the data is a source of nuisance error for the experiment. The null hypothesis for this would be that \(H_o:\beta_j=0\) for all j blocks while the alternative hypothesis would be that \(H_1:\beta_j\neq0\) for at least one of the j blocks. In this case, the blocks would be considered a fixed effect because we are testing to see what effect the different chemicals have on these specific types of cloth.

The testing of this data will be done using the GAD package. The code chunk below shows the analysis.

model1<-lm(obs~chemical+bolt, data = dat)
gad(model1)
## $anova
## Analysis of Variance Table
## 
## Response: obs
##           Df Sum Sq Mean Sq F value    Pr(>F)    
## chemical   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

The analysis yielded a p-value of 0.1211 for the “chemical” factor. Using a significance level of \(\alpha=0.15\), we reject the null hypothesis since the p-value is less than the significance level. There is enough statistical evidence to suggest that at least one of means of the chemicals differs from the others.

3 Problem 2

Assume now that she didn’t block on Bolt and rather ran the experiment as a completely randomized design on random pieces of cloth, resulting in the following data. Analyze the data from this experiment (use α=0.15) and draw appropriate conclusions. Be sure to state the linear effects model and hypotheses being tested.

The linear effects equation for a completely randomized design has three variables that have an impact on the response. These three variables are the grand mean, the effect of the individual population, and the random error associated with the measurement. A more concise way to express this is in the equation below.

\[ x_{ij}=\mu+\tau_i+\epsilon_{ij} \]

For a completely randomized design, the primary interest is whether or not there is a difference in the means of the four different chemicals. The null hypothesis for this would be that \(H_o:\tau_i=0\) for all i populations while the alternative hypothesis would be that \(H_1:\tau_i\neq0\) for at least one of the i populations.

The testing of this data will be done using the GAD package. The code chunk below shows the analysis.

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

The analysis yielded a p-value of 0.7644 for the “chemical” factor. Using a significance level of \(\alpha=0.15\), we fail to reject the null hypothesis since the p-value is greater than the significance level. There is not enough statistical evidence to suggest that at least one of means of the chemicals differs from the others.

4 Problem 3

Comment on any differences in the findings from questions 1 and 2. Do you believe that the Bolt of cloth represents a significant amount of nuisance variability?

Problem 1 (RCBD) yielded an f-statistic of 2.3761 and p-value of 0.1211 while Problem 2 (CRD) yielded an f-statistic of 0.3863 and p-value of 0.7644. This resulted in one experiment (RCBD) rejecting the null hypothesis while the other experiment (CRD) failed to reject the null hypothesis. The type of cloth is a significant source of nuisance variability that the CRD did not account for. In the RCBD, we saw a p-value of 2.059e-5 for the “bolt” factor. This means that according to our hypothesis from Problem 1, the blocking of the data is a significant source of nuisance error. The RCBD accounts for this and removes it from the f-statistic for the “chemical” factor.

5 Complete R Code

# Package Installs
#install.packages("GAD")
library(GAD)

# Problem 1
chemical<-c(rep(1, 5), rep(2, 5), rep(3, 5), rep(4, 5))
bolt<-c(seq(1, 5), seq(1, 5), seq(1, 5), seq(1, 5))
obs<-c(73, 68, 74, 71, 67, 73, 67, 75, 72, 70, 75, 68, 78, 73, 68, 73, 71, 75, 75, 69)
chemical<-as.fixed(chemical)
bolt<-as.fixed(bolt)
dat<-data.frame(chemical, bolt, obs)

model1<-lm(obs~chemical+bolt, data = dat)
gad(model1)

# Problem 2
model2<-lm(obs~chemical, data = dat)
gad(model2)