We can write Linear effect equation as,
\(Y_{ij} = \mu + \tau_{i} + ß_{j}+ \epsilon_{ij}\)
Following is the hypothesis we are testing
Null Hypothesis : \(H_o : \tau_i = 0\)
Alternative Hypothesis : \(H_a : \tau_i \neq 0\) for some i
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.
observations<-c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
bolt<-c(rep(seq(1,5),4))
chemical<-c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
bolt<-as.fixed(bolt)
chemical<-as.fixed(chemical)
model<-lm(observations~chemical+bolt)
gad(model)
## Analysis of Variance Table
##
## Response: observations
## 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
As p-value is 0.1211, which is greater than 0.05, hence we conclude that we fail to reject the null hypothesis.
From the results of the test we conclude that, the chemical is not significant, while the bolt are statistically significant.
We can write Linear effect equation as,
\(Y_{ij}=\mu + \tau_{i} + ß_{j}+ \epsilon_{ij}\)
To estimate the model parameters by Assuming that chemical types and bolts are fixed, estimate the model parameters \(\tau_{i}\) and ßj in above problem.
mean(observations)
## [1] 71.75
We know, \(\tau_{i} = \mu_{i}\ - \mu\)
where,\(\mu_{i}\) = Mean of ith population in chemical types
\(\mu\) = Grand Mean of observations
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)
mean(chemical1)
## [1] 70.6
tau1<-mean(chemical1)-mean(observations)
tau1
## [1] -1.15
mean(chemical2)
## [1] 71.4
tau2<-mean(chemical2)-mean(observations)
tau2
## [1] -0.35
mean(chemical3)
## [1] 72.4
tau3<-mean(chemical3)-mean(observations)
tau3
## [1] 0.65
mean(chemical4)
## [1] 72.6
tau4<-mean(chemical4)-mean(observations)
tau4
## [1] 0.85
tau1= -1.15 , tau2= -0.35, tau3= 0.65 , tau4= 0.85
We know, \(ßj = \mu_{i}\ - \mu\)
where, \(\mu_{i}\) = Mean of ith population in bolt types
\(\mu\)= Grand Mean of observations
b1<-c(73,73,75,73)
b2<-c(68,67,68,71)
b3<-c(74,75,78,75)
b4<-c(71,72,73,75)
b5<-c(67,70,68,69)
b<-c(b1,b2,b3,b4,b5)
mean(b)
## [1] 71.75
beta1<-mean(b1)-mean(b)
beta1
## [1] 1.75
beta2<-mean(b2)-mean(b)
beta2
## [1] -3.25
beta3<-mean(b3)-mean(b)
beta3
## [1] 3.75
beta4<-mean(b4)-mean(b)
beta4
## [1] 1
beta5<-mean(b5)-mean(b)
beta5
## [1] -3.25
beta1= 1.75 ,beta2= -3.25 ,beta3= 3.75 ,beta4= 1 ,beta5= -3.25
We can write linear effect equation for as ,
\(Y_{ijk} = \mu + \tau_{i} + ß_{j}+ 𝛼_{k} +\epsilon_{ijk}\)
Following is the hypothesis we are testing
Null Hypothesis : \(H_o : \tau_i = 0\)
Alternative Hypothesis : \(H_a : \tau_i \neq 0\) for some i
we concluded that this is a valid Latin Square model as none of the variables are repeated in the rows and columns
batch1 <- c(8,7,1,7,3)
batch2<-c(11,2,7,3,8)
batch3<- c( 4,9,10,1,5)
batch4<-c (6,8,6,6,10)
batch5 <-c (4,2,3,8,8)
batch<- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
batch<- as.factor(batch)
ingredients <- 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")
ingredients<- as.factor(ingredients)
treatments<- c(batch1,batch2,batch3,batch4,batch5)
observation<- treatments
treatments<- as.factor(treatments)
days<- c(rep(seq(1,5),5))
days<-as.factor(days )
aovmodel<- aov(observation~ days+ingredients+batch)
summary(aovmodel)
## Df Sum Sq Mean Sq F value Pr(>F)
## days 4 12.24 3.06 0.979 0.455014
## ingredients 4 141.44 35.36 11.309 0.000488 ***
## batch 4 15.44 3.86 1.235 0.347618
## Residuals 12 37.52 3.13
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From the results of the test we conclude that, the days and batch are not significant, while the ingredients are statistically significant.
The p-value of ingredients is 0.000488, which is less than 0.05, hence we reject the null hypothesis.