1 Question 4.3:

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.05) and draw appropriate conclusions.

1.1 Solution:

Writing the Hypothesis:

Null:\[H_O:\tau_{i}=0\space \space\forall \space"i"\] Alternative:\[H_a:\tau_{i}\neq0\space\space\exists\space\space"i"\]

where, i = chemical agent used in the experiment

Model Equation:

\[y_{i,j}=\mu+\tau_{i}+\beta_{j}+\epsilon_{i,j}\] where,

\(y_{i,j}\)=Observation

\(\mu\)=Grand Mean

\(\tau_{i}\)= is the effect of the ith treatment of chemical agent used

\(\beta_{j}\)= is the effect of the jth block of cloth bolt used

\(\epsilon_{i,j}\)= Random Error term

Reading the Data:

obs<-c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
library(GAD)
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))
bolt<-as.fixed(bolt)
chemical<-as.fixed(chemical)

Performing randomized complete block design test, with bolt type being blocked as we are considering bolt type to be a significant source of nuisance variability, and testing chemical types:

model<-lm(obs~chemical+bolt)
gad(model)
## 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 ***
## Residual 12  21.80   1.817                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Conclusion:

---> With a p-value of 0.1211 and a significance level of 0.05, we fail to reject the Null hypothesis. There is not enough evidence to support the claim of a significant effect of the chemical agent used.

2 Question 4.16:

Assuming that chemical types and bolts are fixed, estimate the model parameters \(\tau_{i}\) and \(\beta_{j}\) in Problem 4.3.

2.1 Solution:

In order to estimate \(\tau_{i}\) and \(\beta_{j}\) we will use the following equations:

\[ \tau_{i}=\bar{y}_{i.}-\bar{y_{..}} \]

AND\[\beta_{j}=\bar{y_{.j}}-\bar{y_{..}}\]

where, each treatment( i= chemical 1-4) and each block j = (bolt 1-5).

G.Mean<-mean(obs)
print(G.Mean)
## [1] 71.75
chem1   <- c(73, 68, 74, 71, 67)
chem2 <-  c(73, 67, 75, 72, 70)
chem3   <- c(75, 68, 78, 73, 68)
chem4 <-  c(73, 71, 75, 75, 69)

Averages of Chemical Type:

Y1.<-mean(chem1)
Y2.<-mean(chem2)
Y3.<-mean(chem3)
Y4.<-mean(chem4)

Calculating \(\tau_{i}\):

tau1<-Y1.-G.Mean
tau2<-Y2.-G.Mean
tau3<-Y3.-G.Mean
tau4<-Y4.-G.Mean
cat(tau1,tau2,tau3,tau4)
## -1.15 -0.35 0.65 0.85

Therefore Results of \(\tau_{i}\) are as follows:

τ1 = -1.15 Ans τ2 = -0.35 Ans τ3 = 0.65 Ans τ4 = 0.85 Ans

Now Calculating Averages of Bolt Types:

bolt1<-c(73,73,75,73)
bolt2<-c(68,67,68,71)
bolt3<-c(74,75,78,75)
bolt4<-c(71,72,73,75)
bolt5<-c(67,70,68,69)

Y.1<-mean(bolt1)
Y.2<-mean(bolt2)
Y.3<-mean(bolt3)
Y.4<-mean(bolt4)
Y.5<-mean(bolt5)

Calculating \(\beta_{i}\):

beta1<-Y.1-G.Mean
beta2<-Y.2-G.Mean
beta3<-Y.3-G.Mean
beta4<-Y.4-G.Mean
beta5<-Y.5-G.Mean
cat(beta1,beta2,beta3,beta4,beta5)
## 1.75 -3.25 3.75 1 -3.25

Therefore the Results of \(beta_{j}\) are as follows:

β1 = 1.75 Ans β2 = -3.25 Ans β3 = 3.75 Ans β4 = 1 Ans β5 = -3.25 Ans

3 Question 4.22:

The effect of five different ingredients (A, B, C, D, E) on the reaction time of a chemical process is being studied. Each batch of new material is only large enough to permit five runs to be made. Furthermore, each run requires approximately 1.5 hours, so only five runs can be made in one day. The experimenter decides to run the experiment as a Latin square so that day and batch effects may be systematically controlled. She obtains the data that follow. Analyze the data from this experiment use \(\alpha\)= 0.05 and draw conclusions.

3.1 Solution:

We will use a Latin Squares design to analyze the effect of five different ingredients on the reaction time of a chemical process under study where the day and batch effects may be systematically controlled.

Assuming \(\tau_{i}\) is the ingredient effect, and thus we define our null and alternative hypotheses as

Stating the Hypothesis:

Null:\[H_O:\tau_{i}=0\space \space\forall \space"i"\] Alternative:\[H_a:\tau_{i}\neq0\space\space\exists\space\space"i"\]

Model Equation:

\[y_{i,j}=\mu+\tau_{i}+\beta_{j}+\alpha_{k}+\epsilon_{i,j}\] where,

\(y_{i,j}\)=Observation

\(\mu\)=Grand Mean

\(\tau_{i}\)= is the effect of the ith treatment of ingredient used

\(\beta_{j}\)= is the effect of the jth block on batch

\(\epsilon_{i,j}\)= Random Error term

\(\alpha_{k}\)=is the effect of the jth block on day

Reading the Data:

Obs <- c(8,7,1,7,3,11,2,7,3,8,4,9,10,1,5,6,8,6,6,10,4,2,3,8,8)
Batch <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5)
Day <- c(rep(seq(1,5),5))
Ingredient <- c(1,2,4,3,5,3,5,1,4,2,2,1,3,5,4,4,3,5,2,1,5,4,2,1,3)
Batch <- as.factor(Batch)
Day <- as.factor(Day)
Ingredient <- as.factor(Ingredient)
Data <- data.frame(Obs, Batch, Day, Ingredient)
str(Data)
## 'data.frame':    25 obs. of  4 variables:
##  $ Obs       : num  8 7 1 7 3 11 2 7 3 8 ...
##  $ Batch     : Factor w/ 5 levels "1","2","3","4",..: 1 1 1 1 1 2 2 2 2 2 ...
##  $ Day       : Factor w/ 5 levels "1","2","3","4",..: 1 2 3 4 5 1 2 3 4 5 ...
##  $ Ingredient: Factor w/ 5 levels "1","2","3","4",..: 1 2 4 3 5 3 5 1 4 2 ...
---> Data arranged in an orthogonal Latin square

Running Analysis:

model<-aov(Obs~Ingredient+Batch+Day,data=Data)
summary(model)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Ingredient   4 141.44   35.36  11.309 0.000488 ***
## Batch        4  15.44    3.86   1.235 0.347618    
## Day          4  12.24    3.06   0.979 0.455014    
## Residuals   12  37.52    3.13                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Conclusion:

---> The p-value of the ingredient is 0.000488, which is significantly lower than that of α = 0.05 hence we reject the null hypothesis. Additionally, the p-values of the two blocks (batch & day) are much greater than alpha, indicating that they are sources of nuisance variability. In conclusion, the ingredients do have an effect on the reaction time

4 Source Code:

getwd()
installed.packages("GAD")
library(GAD)

#Question4.3:
obs<-c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
library(GAD)
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))
bolt<-as.fixed(bolt)
chemical<-as.fixed(chemical)
model<-lm(obs~chemical+bolt)
gad(model)

#Question4.16:
G.Mean<-mean(obs)
print(G.Mean)
chem1   <- c(73, 68, 74, 71, 67)
chem2 <-  c(73, 67, 75, 72, 70)
chem3   <- c(75, 68, 78, 73, 68)
chem4 <-  c(73, 71, 75, 75, 69)
Y1.<-mean(chem1)
Y2.<-mean(chem2)
Y3.<-mean(chem3)
Y4.<-mean(chem4)
tau1<-Y1.-G.Mean
tau2<-Y2.-G.Mean
tau3<-Y3.-G.Mean
tau4<-Y4.-G.Mean
cat(tau1,tau2,tau3,tau4)

bolt1<-c(73,73,75,73)
bolt2<-c(68,67,68,71)
bolt3<-c(74,75,78,75)
bolt4<-c(71,72,73,75)
bolt5<-c(67,70,68,69)

Y.1<-mean(bolt1)
Y.2<-mean(bolt2)
Y.3<-mean(bolt3)
Y.4<-mean(bolt4)
Y.5<-mean(bolt5)

beta1<-Y.1-G.Mean
beta2<-Y.2-G.Mean
beta3<-Y.3-G.Mean
beta4<-Y.4-G.Mean
beta5<-Y.5-G.Mean
cat(beta1,beta2,beta3,beta4,beta5)

#Question4.22:
Obs <- c(8,7,1,7,3,11,2,7,3,8,4,9,10,1,5,6,8,6,6,10,4,2,3,8,8)
Batch <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5)
Day <- c(rep(seq(1,5),5))
Ingredient <- c(1,2,4,3,5,3,5,1,4,2,2,1,3,5,4,4,3,5,2,1,5,4,2,1,3)
Batch <- as.factor(Batch)
Day <- as.factor(Day)
Ingredient <- as.factor(Ingredient)
Data <- data.frame(Obs, Batch, Day, Ingredient)
str(Data)

model<-aov(Obs~Ingredient+Batch+Day,data=Data)
summary(model)