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 \(\alpha\) as 0.05) and draw appropriate conclusions.

Hypothesis:

Null hypothesis: \(H_0: \mu_{1}=\mu_{2}=\mu_{3}=\mu\)

Alternative hypothesis: \(H_1:\) at least one \(\mu_{i}\) differs

library(GAD)
## Carregando pacotes exigidos: matrixStats
## Carregando pacotes exigidos: R.methodsS3
## R.methodsS3 v1.8.1 (2020-08-26 16:20:06 UTC) successfully loaded. See ?R.methodsS3 for help.
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:matrixStats':
## 
##     count
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
dat<-read.csv("C:/Users/Gabriel Farias Cacao/OneDrive/TTU/Classes/Design of Experiments/homework7.csv",header=TRUE)
dat<-pivot_longer(dat,c(bolt1,bolt2,bolt3,bolt4,bolt5))
colnames(dat)<-c("x","name","value")
Chemical<-as.fixed(dat$x)
Chemical
##  [1] chem1 chem1 chem1 chem1 chem1 chem2 chem2 chem2 chem2 chem2 chem3 chem3
## [13] chem3 chem3 chem3 chem4 chem4 chem4 chem4 chem4
## Levels: chem1 chem2 chem3 chem4
Bolt<-as.random(dat$name)
# result is the same using block as random or fixed
obs<-c(dat$value) 
obs
##  [1] 73 68 74 71 67 73 67 75 72 70 75 68 78 73 68 73 71 75 75 69
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
model2<-lm(obs~Chemical, data = dat)
gad(model2)
## 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
## Residual 16 178.80 11.1750

p-value = 0.1211 < \(\alpha\) of 0.15.

Thus, he would reject the Null Hypothesis.

Question 4.16

Assuming that chemical types and bolts are fixed, estimate the model parameters $_i $and \(\beta_j\) in Problem 4.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 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.

type1 <-    c(8,    7   ,1,7    ,3)
type2 <-    c(11,2  ,7  ,3  ,8)
type3 <-    c(4,    9,10,1  ,5)
type4   <- c(6, 8   ,6  ,6,10)
type5 <-    c(4,    2,  3   ,8,8)
letters <- c('A','B','D','C','E','C','E','A','D','B','B','A','C','E','D','D','C','E','B','A','E','D','B','A','C')
dafr <- data.frame(type1,type2,type3,type4,type5)
dafr <- stack(dafr)
days <- c(rep(seq(1,5),5))
dafr$letters <- as.factor(letters)
dafr$days <- as.factor(days)

summary(aov(values~ind+days+letters,dafr))
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## ind          4  15.44    3.86   1.235 0.347618    
## days         4  12.24    3.06   0.979 0.455014    
## letters      4 141.44   35.36  11.309 0.000488 ***
## Residuals   12  37.52    3.13                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Ingredients used is the only factor to have a p-value below our alpha of .05. Thus, ingredients is the only factor with statistical significance.

All code

library(GAD)
library(tidyr)
library(dplyr)
dat<-read.csv("C:/Users/Gabriel Farias Cacao/OneDrive/TTU/Classes/Design of Experiments/homework7.csv",header=TRUE)
dat<-pivot_longer(dat,c(bolt1,bolt2,bolt3,bolt4,bolt5))
colnames(dat)<-c("x","name","value")
Chemical<-as.fixed(dat$x)
Chemical
Bolt<-as.random(dat$name)
# result is the same using block as random or fixed
obs<-c(dat$value) 
obs
model<-lm(obs~Chemical+Bolt)
gad(model)
model2<-lm(obs~Chemical, data = dat)
gad(model2)

type1 <-    c(8,    7   ,1,7    ,3)
type2 <-    c(11,2  ,7  ,3  ,8)
type3 <-    c(4,    9,10,1  ,5)
type4   <- c(6, 8   ,6  ,6,10)
type5 <-    c(4,    2,  3   ,8,8)
letters <- c('A','B','D','C','E','C','E','A','D','B','B','A','C','E','D','D','C','E','B','A','E','D','B','A','C')
dafr <- data.frame(type1,type2,type3,type4,type5)
dafr <- stack(dafr)
days <- c(rep(seq(1,5),5))
dafr$letters <- as.factor(letters)
dafr$days <- as.factor(days)

summary(aov(values~ind+days+letters,dafr))