Q 4.3, Q 4.16
bolts<- c(rep(seq(1,5),4))
chemical <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
obs <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
data<-data.frame(bolts,chemical,obs)
Hypothesis:
Null Hypothesis:
\(H_o : \mu_1 = \mu_2 =\mu_i\)
Alternative Hypothesis:
\(Ha\) : Atleast one \(\mu_i\) differs
As we have the Fixed Effect, our hypothesis comes to be.
Null Hypothesis:
\(H_o : \tau_i=0\) for all i
Alternative Hypothesis:
\(H_a\) : \(\tau_i \neq 0\) for some i
Linear Effects Equation:
\(y_{ij} = \mu + \tau_i + \beta_j +
\epsilon_{ij}\)
library(GAD)
## Warning: package 'GAD' was built under R version 4.1.3
## Loading required package: matrixStats
## Warning: package 'matrixStats' was built under R version 4.1.3
## Loading required package: R.methodsS3
## Warning: package 'R.methodsS3' was built under R version 4.1.3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
chemical<- as.fixed(chemical)
bolts<- as.fixed(bolts)
model<-lm(obs~bolts+chemical)
gad(model)
## Analysis of Variance Table
##
## Response: obs
## Df Sum Sq Mean Sq F value Pr(>F)
## bolts 4 157.00 39.250 21.6055 2.059e-05 ***
## chemical 3 12.95 4.317 2.3761 0.1211
## Residual 12 21.80 1.817
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
P-value is 0.1211 > \(\alpha\) = $0.05, we fail to reject Null
Hypothesis.
We could say that the chemical agents doesnโt have effect on the
strength of the cloth for given level of significance.
The Model Parameters: \(\tau_i\) is of the chemicals and \(\beta_j\) is of bolts. From the ANOVA table
above.
Source Code (Q 4.3, Q 4.16).
bolts<- c(rep(seq(1,5),4))
chemical <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
obs <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
data<-data.frame(bolts,chemical,obs)
library(GAD)
chemical<- as.fixed(chemical)
bolts<- as.fixed(bolts)
model<-lm(obs~bolts+chemical)
gad(model)
4.22
Days<-c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
Batch<-c(rep(seq(1,5),5))
Ingredients<-c("A","C","B","D","E","B","E","A","C","D","D","A","C","E","B", "C","D","E","B","A","E","B","D","A","C")
obser<- c(8,11,4,6,4,7,2,9,8,2,1,7,10,6,3,7,3,1,6,8,3,8,5,10,8)
Days <-as.factor(Days)
Ingredients <-as.factor(Ingredients)
Batch <-as.factor(Batch)
Hypothesis (Fixed Effects)
Null Hupothesis:
\(\tau_1 = \tau_2 = \tau_i\) =
0$
Alternative Hypothesis:
\(\tau_i \neq 0\)
Model Analysis.
Model <- aov(obser ~ Batch+Days+Ingredients)
anova(Model)
## Analysis of Variance Table
##
## Response: obser
## Df Sum Sq Mean Sq F value Pr(>F)
## Batch 4 15.44 3.860 1.2345 0.3476182
## Days 4 12.24 3.060 0.9787 0.4550143
## Ingredients 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
P value of the ingredients is 0.000218 < \(\alpha\) = $0.05, we have sufficient
evidence to reject Null Hypothesis.
We could conclude as the different ingredients (A, B, C, D, E)
has effects on reaction time of a chemical process.