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)
We setup the data frame for our problem.
#install the GAD package
#install.packages("GAD")
library(GAD)
#start setup for the chemical
chemical<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
#Insert our observations
bolt_obs<- c(73,68,74,71,73,67,75,72,75,68,78,73,73,71,75,75)
Setup the chemical as a factor and make our model with the lm command
chemical<-as.fixed(chemical)
model<-lm(bolt_obs~chemical)
Our linear effect model is:
\[{x_{ij}} = \mu + {\tau _i} + {\varepsilon _{ij}}\]
Our hypthesis being tested is:
\[{H_0}:{\mu _1} = {\mu _2} = {\mu _3} = {\mu _4}\] \[{H_A}:{\mu _1} \ne {\mu _2} \ne {\mu _3} \ne {\mu _4}\]
We now run the General ANOVOA design command for our analysis
gad(model)
## $anova
## Analysis of Variance Table
##
## Response: bolt_obs
## Df Sum Sq Mean Sq F value Pr(>F)
## chemical 3 14.187 4.7292 0.4739 0.7062
## Residuals 12 119.750 9.9792
From the result we can see that we would fail to reject the null hypothesis and we can conclude that the means are all similiar between the samples with no significant difference.
Assume now that she didn’t block on Bolt and rather ran the experiment at 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.
We set up the factor and block for the CRD
#setup our factor and block
chemical<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
bolt_num<-c(seq(1,4),seq(1,4),seq(1,4),seq(1,4))
#insert our observations
bolt_obs<- c(73,68,74,71,73,67,75,72,75,68,78,73,73,71,75,75)
chemical<-as.fixed(chemical)
bolt_num<-as.fixed(bolt_num)
model<-lm(bolt_obs~chemical+bolt_num)
We run the general ANOVA design command for our results
gad(model)
## $anova
## Analysis of Variance Table
##
## Response: bolt_obs
## Df Sum Sq Mean Sq F value Pr(>F)
## chemical 3 14.187 4.729 2.7349 0.1057217
## bolt_num 3 104.188 34.729 20.0843 0.0002515 ***
## Residuals 9 15.563 1.729
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The result indicates that we would reject the null hypothesis at the 0.15 confidence level. This indicates that there is some evidence that the bolts differ in a significant fashion when we do a completely random analysis. We a completely different result from our initial analysis that did not take in account a CRD.
knitr::opts_chunk$set(echo = TRUE,warning=FALSE, message=FALSE)
#install.packages("GAD")
#library(GAD)
#Data & Data Frame Setup
chemical<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
bolt_obs<- c(73,68,74,71,73,67,75,72,75,68,78,73,73,71,75,75)
chemical<-as.fixed(chemical)
# x_ij=mu+t_i+e_ij
model<-lm(bolt_obs~chemical)
#Run the General ANOVA
gad(model)
#part 2
#data setup
chemical<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
bolt_num<-c(seq(1,4),seq(1,4),seq(1,4),seq(1,4))
bolt_obs<- c(73,68,74,71,73,67,75,72,75,68,78,73,73,71,75,75)
#lets do a CRD with a
chemical<-as.fixed(chemical)
bolt_num<-as.fixed(bolt_num)
# Setup the model
model<-lm(bolt_obs~chemical+bolt_num)
#Do the GAD Analysis
gad(model)