Question 4.3

Getting in data, we have

chemical1   <- c(73, 68, 74, 71, 67)
chemical2 <-  c(73, 67, 75, 72, 70)
chemical3   <- c(75, 68, 78, 73, 68)
chemical4 <-  c(73, 71, 75, 75, 69)
dat<- data.frame(chemical1,chemical2,chemical3,chemical4)
dat <- stack(dat)
colnames(dat) <- c('Number','Type')
library(GAD)
dat$Type <- as.fixed(dat$Type)
dat$Bolt <- c(rep(seq(1,5),4))
dat$Bolt <- as.fixed(dat$Bolt)

Because we have fixed effect our hypothesis can be written as

The Linear Effects model can be written has;

yij=μ+τi+βj+ϵij

μ is the grand mean value

τi is the fixed effects for treatment i

Where βj is the block effect for j

Where ϵij is the random error

A Randomized Complete Block Design test is being done, where bolt type being blocked (because we are considering bolt type to be a significant source of nuisance variability), and testing chemical types.

model1<- lm(Number~Type+Bolt,dat)
gad(model1)
## Analysis of Variance Table
## 
## Response: Number
##          Df Sum Sq Mean Sq F value    Pr(>F)    
## Type      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

The p-value for our model is 0.1211, which is greater than our reference significance level (0.05). So therefore we fail to reject Ho, and thus we conclude that different chemical agents do not have a significant effect on the mean strength

QUESTION 4.16

Getting data

AND

Estimating Tau

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)
chems<- c(chem1,chem2,chem3,chem4)
tau1 <- mean(chem1)-mean(chems)
tau2 <- mean(chem2)-mean(chems)
tau3 <- mean(chem3)-mean(chems)
tau4 <- mean(chem4)-mean(chems)

Getting data to get beta_j

Chem5 <- c(73,73,75,73)
Chem6 <- c(68,67,68,71)
Chem7 <- c(74,75,78,75)
Chem8 <- c(71,72,73,75)
Chem9 <- c(67,70,68,69)
Chem10<- c(Chem5,Chem6,Chem7,Chem8,Chem9)

Estimating beta_j, we have

beta1<- mean(Chem5)-mean(Chem10)
beta2<- mean(Chem6)-mean(Chem10)
beta3<- mean(Chem7)-mean(Chem10)
beta4<- mean(Chem8)-mean(Chem10)
beta5<- mean(Chem9)-mean(Chem10)

Answers:

τ1= -1.15

τ2= -0.35,

τ3= 0.65,

τ4= 0.85,

β1= 1.75,

β2= -3.25,

β3=3.75

β4=1,

β5=-3.25

Question 4.22

Getting in data

library(GAD)
batchs<- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
Days<- c(rep(seq(1,5),5))
ingred<- 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")
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)
dat<- cbind(batchs,Days,ingred,obs)
dat<- as.data.frame(dat)
dat$batchs<- as.fixed(dat$batchs)
dat$Days<- as.fixed(dat$Days)
dat$ingred <- as.fixed(dat$ingred)

Hypothesis:

Because it has fixed effects hence we can write our hypothesis as,

Writing the Model Equation

Xij=μ+τi+βj+αk+ϵijk

Where,

Xij=Observation

μ=Grand Mean

τi=Effect for "i"

βj= First Block Factor

αk= Second Block Factor

ϵijk= Random Error

model1<- lm(dat$obs~dat$batchs+dat$Days+dat$ingred,data = dat)
anova(model1)
## Analysis of Variance Table
## 
## Response: dat$obs
##            Df Sum Sq Mean Sq F value    Pr(>F)    
## dat$batchs  4  15.44   3.860  1.2345 0.3476182    
## dat$Days    4  12.24   3.060  0.9787 0.4550143    
## dat$ingred  4 141.44  35.360 11.3092 0.0004877 ***
## Residuals  12  37.52   3.127                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Since our p value for our calculated model analysis(0.0004877) for ingredients is lesser than our reference p-value (0.05). we are reject the null hypothesis and stating to conclude that there is a significant effect of the types of ingredients on the mean reaction times of chemical processes.