Question 3.2
#install.packages(GAD)
library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.1 (2020-08-26 16:20:06 UTC) successfully loaded. See ?R.methodsS3 for help.
chemi<-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))
observations<-c(73, 68, 74, 71, 67, 73, 67, 75, 72, 70, 75, 68, 78, 73, 68, 73, 71, 75, 75, 69)
library(GAD)
chemi<-as.fixed(chemi)
bolt<-as.fixed(bolt)
Test Hypothesis :Null hypothisis: μ1=μ2=μ3=μ4
Alternate Hypothisis: At least 1 differs of μa
Linear Effects equation for the
y{ij}=\(\mu M\)+\(\tau T\)i+\(\beta B\)i+\(\epsilon\){ij}
model<-lm(observations~chemi+bolt)
gad(model)
## Analysis of Variance Table
##
## Response: observations
## Df Sum Sq Mean Sq F value Pr(>F)
## chemi 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
Our p-value is 0.1211 is greater than alpha= 0.05 level of significance . we fail to reject Hypothesis, we conclude that chemicals do not have a significant effect on the mean strength.
Question 3.16
chemi<-c(70.5,71.4,72.4,72.6)
mean(chemi)
## [1] 71.725
chemi1<-c(73,68,74,71,67)
mean(chemi1)
## [1] 70.6
chemi2<-c(73,67,75,72,70)
mean(chemi2)
## [1] 71.4
chemi3<-c(75,68,78,73,68)
mean(chemi3)
## [1] 72.4
chemi4<-c(73,71,75,75,69)
mean(chemi4)
## [1] 72.6
bolt1<-c(73,73,75,73)
mean(bolt1)
## [1] 73.5
bolt2<-c(68,67,71,68)
mean(bolt2)
## [1] 68.5
bolt3<-c(74,75,78,75)
mean(bolt3)
## [1] 75.5
bolt4<-c(71,72,73,75)
mean(bolt4)
## [1] 72.75
bolt5<-c(67,70,68,69)
mean(bolt5)
## [1] 68.5
Calculating τi:
T1 = chemi1 - μ = -1.15
T2 = chemi2 - μ = -0.35
T3 = chemi3 - μ = 0.65
T4 = chemi4 - μ = 0.85
Calculating βj:
B1 = bolt1 - μ = 1.75
B2 = bolt2 - μ = -3.25
B3 = bolt3 - μ = 3.75
B4 = bolt4 - μ = 1
B5 = bolt5 - μ = -3.25
QUESTION 3.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))
Ing <- 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)
Ing <- as.factor(Ing)
Data1 <- data.frame(Obs, Batch, Day, Ing)
Test Hypothesis
Null hypothisis: μ1=μ2=μ3=μ4 - Null Hypothesis
alternate hypothisis: At least 1 differs - Alternative Hypothesis
aplha = 0.05
we didn’t repeat the data in any observations row or coloum so we can conclude that it is an orthogonal Latin square.
linear model effects equation:
Y_{i,j,k} = \(\mu M\) + \(\tau T\)i + \(\beta B\)j + \(\alpha A\)k + \(\epsilon\) {i,j,k}
aov.model<-aov(Obs~Ing+Batch+Day,data=Data1)
summary(aov.model)
## Df Sum Sq Mean Sq F value Pr(>F)
## Ing 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
In anova test the p-value = 0.000488 is less than 0.05 ,so, we reject the null hypothesis & we conclude that there’s a significant effect of ingredients on the mean reaction times of chemical processes.