We want to test the hypotheses of equal means against the hypotheses of at least one being different:
\[ H_0: \tau_i = 0 \]
\[ H_a: \tau_i \neq 0 \]
The linear effects model is shown by the equation below:
\[ y_{ij} = \mu_i + \tau_i + \beta_j = \epsilon_{ij}\]
where \(\mu_i, \tau_i, \beta_j, \epsilon_{ij}\), represents, respectively the average of the ith treatment, the interaction between treatments, additive effect of the blocks and normal random error.
library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
chemical<-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))
obs<- c(73,68,74,71,67,
73,67,75,72,70,
75,68,78,73,68,
73,71,75,75,69)
chemical<-as.fixed(chemical)
bolt <- as.fixed(bolt)
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
Conclusion:
With an \(\alpha\) = 0.05, the null hypothesis is not rejected (P-value = 0.1211).
\[ y_{ijk}=\mu+\tau_i+\beta_j+\alpha_k+\epsilon_{ijk} \]
\[ i = j = k = (1,2,3,4,5) \]
\(\mu\) = Baseline mean
\(\tau\) = Treatments (Ingredients)
\(\beta\) = Batch of materials
\(\alpha\) = Day of production
\(\epsilon\) = Random error
library(GAD)
batch<-c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
day<-c(seq(1,5),seq(1,5),seq(1,5),seq(1,5),seq(1,5))
variable<-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")
value<-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<-data.frame(batch,day,variable,value)
dat$batch<-as.fixed(dat$batch)
dat$day<-as.fixed(dat$day)
dat$variable<-as.fixed(dat$variable)
model<-lm(value~batch+day+variable,data = dat)
anova(model)
## Analysis of Variance Table
##
## Response: value
## Df Sum Sq Mean Sq F value Pr(>F)
## batch 4 15.44 3.860 1.2345 0.3476182
## day 4 12.24 3.060 0.9787 0.4550143
## variable 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
Conclusion:
Since the p-value for treatments is 0.0004877 which is very less than 0.05 therefore we can successfully reject the null hypothesis that the mean are equal with 95% confidence.