For the hypothesis that we are trying to test is:
\[ H_o: \mu_1=\mu_2=\mu_3=\mu_4=\mu \\ Ha: \mu_k \neq \mu \;for \; any\;k \]
Given the following linear equation:
\[ y_{ij}=\mu+\tau_i+\beta_j+\epsilon_{ij} \]
Where \(\tau_i\) is the treatment effect error and \(\beta_j\) is the block 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.
bolts <- c(seq(1,5),seq(1,5),seq(1,5),seq(1,5))
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)
bolts <- as.fixed(bolts)
chemical <- as.fixed(chemical)
model <- lm(obs~chemical+bolts)
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
## bolts 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
From the result above, since the p-value of the chemicals is higher than \(\alpha\) (\(p-value=0.1211 > \alpha=0.05\)) we cannot successfully reject Ho and consider that there is at least one mean that differ between chemicals
For this question, the results were calculated in a excel spreadsheet. These results are presented in the image below:
Results for the treatments and blocks errors
For this test, the hypothesis that we are going to test is:
\[ H_o: \mu_1=\mu_2=\mu_3=\mu_3=\mu \\ H_a: \mu_k \neq \mu \; for \; any \; k \]
And the linear equation is considering two sources of nuisance variability:
\[ y_{ijk}=\mu+\tau_i+\beta_k+\alpha_k+\epsilon_{ijk} \]
library(GAD)
day <- c(seq(1,5),seq(1,5),seq(1,5),seq(1,5),seq(1,5))
batch <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
ing <- 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)
day <- as.fixed(day)
batch <- as.fixed(batch)
ing <- as.fixed(ing)
dat <- data.frame(batch,day,ing,obs)
mod <- aov(obs~batch+day+ing,data=dat)
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## batch 4 15.44 3.86 1.235 0.347618
## day 4 12.24 3.06 0.979 0.455014
## ing 4 141.44 35.36 11.309 0.000488 ***
## Residuals 12 37.52 3.13
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From the result above, since the p-value of the chemicals is higher than \(\alpha\) (\(p-value=0.000488 < \alpha=0.05\)) we can successfully reject Ho and consider that the ingredients impact directly into the reaction time of the chemical process