Linear effect equation:
\[ _{Yij=\mu +\tau _{i}+\beta _{j}+\epsilon _{ij}} \]
Null hypotheses = \(H_{0}:\mu_{ 1}=\mu_{ 2}=\mu_{ 3}=\mu_{ 4}\)
Alternative Hypotheses = Atleast one mu differs
Question 1:
Chemical <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
Bolt <- rep(seq(1,5),4)
Obs <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
dat <- data.frame(Chemical,Bolt,Obs)
library(GAD)
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
P-value is less than alpha 0.15, reject Ho.
Quest tion 2:
Conduct the analysis without blocking
model1 <- lm(Obs~Chemical)
gad(model1)
## Analysis of Variance Table
##
## Response: Obs
## Df Sum Sq Mean Sq F value Pr(>F)
## Chemical 3 12.95 4.3167 0.3863 0.7644
## Residual 16 178.80 11.1750
P-value is greater than alpha, we don’t have evidence to reject the Ho hypothesis
Question 3:
In question 1, we have more power to reject the Ho by adding block in our experiment design. In question 2 doesn’t have blocking so the sum of square of blocking is added into the sum of square error making it less power.
It is a good idea to include this at the end of every RMarkdown document
#Model with Block
Chemical <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
Bolt <- rep(seq(1,5),4)
Obs <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
dat <- data.frame(Chemical,Bolt,Obs)
library(GAD)
Chemical <- as.fixed(Chemical)
Bolt <- as.fixed(Bolt)
model <- lm(Obs~Chemical+Bolt)
gad(model)
#Model without the block
model1 <- lm(Obs~Chemical)
gad(model1)