The Linear effects model for a randomized block design (RCBD ) is:
Hypothesis: If the chemicals differ:
\[ y_{ij}: \mu + \alpha_i + \beta_{j} + \varepsilon{ij} = 0 \] Hypothesis: \[ H_0: \alpha_1 = \alpha_2 =\alpha_3 =\alpha_4 = 0 \] Alternative: \[ H_a : \text{at least one} \ \alpha \neq 0 \]
#Install Packages
#install.packages("GAD")
library(GAD)
resp<-c(73,68,74,71,73,67,75,72,75,68,78,73,73,71,75,75)
chem <- c(rep(1,4), rep(2,4), rep(3,4), rep(4,4))
bolt <- c(rep(seq(1,4),4))
#RCBD with chemical fixed and bolt random
chem <- as.fixed(chem)
bolt <- as.random(bolt)
model <- lm(resp ~ chem+bolt)
gad(model)
## $anova
## Analysis of Variance Table
##
## Response: resp
## Df Sum Sq Mean Sq F value Pr(>F)
## chem 3 14.187 4.729 2.7349 0.1057217
## bolt 3 104.188 34.729 20.0843 0.0002515 ***
## Residuals 9 15.563 1.729
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#RCBD with chemical random bold fixed
chem <- as.random(chem)
bolt <- as.fixed(bolt)
model2 <- lm(resp ~ chem+bolt)
gad(model2)
## $anova
## Analysis of Variance Table
##
## Response: resp
## Df Sum Sq Mean Sq F value Pr(>F)
## chem 3 14.187 4.729 2.7349 0.1057217
## bolt 3 104.188 34.729 20.0843 0.0002515 ***
## Residuals 9 15.563 1.729
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Chemical (treatment) effect: p = 0.106 < 0.15 which is significant at least one chemical differs in mean strength.
Bolt (block) effect: p = 0.00025 < 0.05 → highly significant , bolts vary a lot; blocking was effective.
Completely Randomized Design:
\[ y_{ij}: \mu + \alpha_i + \varepsilon{ij} = 0 \]
Hypothesis: \[ H_0: \alpha_2 =\alpha_3 =\alpha_4 = 0 \] Alternative: \[ H_a: \text{at least one} \ \alpha \neq 0 \]
chem <- c(rep(1,4), rep(2,4), rep(3,4), rep(4,4))
resp <- c(73,68,74,71,73,67,75,72,75,68,78,73,73,71,75,75)
chem <- as.fixed(chem)
model_crd <- lm(resp ~ chem)
gad(model_crd)
## $anova
## Analysis of Variance Table
##
## Response: resp
## Df Sum Sq Mean Sq F value Pr(>F)
## chem 3 14.187 4.7292 0.4739 0.7062
## Residuals 12 119.750 9.9792
since the p = 0.4739 > 0.15 so, we can fail to reject null hypothesis. So, there is no significant difference between chemical means we ignore bolt difference.
In question 1 we have done RCBD , the analysis gives for chemical p = 0.106 which significant , at least one chemical differs, and bolt, p = .00025 is highly significant , where bolts differ strongly. In Question 2 we ignored the bolts and analyze the data as if all piece of cloth is identical. That analysis gave a p = 0.4739 for the chemical no significant different. Overall this the bolt of cloth clearly contributes a significant amount of nuisance variability. Using a randomized complete block design was appropriate and improved the accuracy and sensitivity of the experiment.
library(GAD)
resp<-c(73,68,74,71,73,67,75,72,75,68,78,73,73,71,75,75)
chem <- c(rep(1,4), rep(2,4), rep(3,4), rep(4,4))
bolt <- c(rep(seq(1,4),4))
#RCBD with chemical fixed and bolt random
chem <- as.fixed(chem)
bolt <- as.random(bolt)
model <- lm(resp ~ chem+bolt)
gad(model)
#RCBD with chemical random bold fixed
chem <- as.random(chem)
bolt <- as.fixed(bolt)
model2 <- lm(resp ~ chem+bolt)
gad(model2)
# CRD Desgin
chem <- c(rep(1,4), rep(2,4), rep(3,4), rep(4,4))
resp <- c(73,68,74,71,73,67,75,72,75,68,78,73,73,71,75,75)
chem <- as.fixed(chem)
model_crd <- lm(resp ~ chem)
gad(model_crd)