library(GAD)
A chemist wishes to test the effect of four chemical agents on the strength of a particular type of cloth. Because there might be variability from one bolt to another, the chemist decides to use a randomized block design, with the bolts of cloth considered as blocks. She selects five bolts and applies all four chemicals in random order to each bolt. The resulting tensile strengths follow. Analyze the data from this experiment (use α=0.15) and draw appropriate conclusions. Be sure to state the linear effects model and hypotheses being tested. (Note: Consider whether the block (Bolt) is a fixed or random effect when performing your analysis)
chemical<-as.fixed(rep(1:4,each = 5))
bolt<-as.random(rep(1:5,times = 4))
strength <- c(73,68,74,71,67,
73,67,75,72,70,
75,68,78,73,68,
73,71,75,75,69)
dat<-data.frame(strength,chemical,bolt)
dat
## strength chemical bolt
## 1 73 1 1
## 2 68 1 2
## 3 74 1 3
## 4 71 1 4
## 5 67 1 5
## 6 73 2 1
## 7 67 2 2
## 8 75 2 3
## 9 72 2 4
## 10 70 2 5
## 11 75 3 1
## 12 68 3 2
## 13 78 3 3
## 14 73 3 4
## 15 68 3 5
## 16 73 4 1
## 17 71 4 2
## 18 75 4 3
## 19 75 4 4
## 20 69 4 5
Linear Effects Model:
\[x_{ij}=\mu+\tau_{i}+\beta_{j}+\epsilon_{ij}\]
Null & Alternative Hypothesis:
\[H_{0}:\tau_{1}=\tau_{2}=...=\tau_{i}=0 \text{ for all }i\]
\[H_{a}:\tau_{i}\neq0 \text{ for at least one }i \]
RCBD
model_1<-lm(strength~chemical+bolt)
gad(model_1)
## $anova
## Analysis of Variance Table
##
## Response: strength
## 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 ***
## Residuals 12 21.80 1.817
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Chemical Critical Value
ccv<-qf(0.85,3,12)
ccv
## [1] 2.127759
Bolt Critical Value
bcv<-qf(0.85,4,12)
bcv
## [1] 2.056789
plot(model_1, which = (1:2))
Based on the QQ plot of the residuals and the residuals vs fitted plot, it appears that the data is approximately normally distributed and the variance is constant.
Since the p-value for chemical (0.121) is less than alpha (0.15) and the F test statistic (2.376) is greater than the critical value (2.128); it can be concluded that at least one chemical affects the mean tensile strength differently than the others. The bolt p-value (2.059e-05) is less than the alpha (0.15) and the F test statistic (21.61) is greater than the bolt critical value (2.06).
Based on these findings, there is sufficient evidence to reject the null hypothesis.
Assume now that she didn’t block on Bolt and rather ran the experiment at a completely randomized design on random pieces of cloth, resulting in the following data. Analyze the data from this experiment (use α=0.15) and draw appropriate conclusions. Be sure to state the linear effects model and hypotheses being tested.
chemical<-as.fixed(rep(1:4,each = 5))
strength <- c(73,68,74,71,67,
73,67,75,72,70,
75,68,78,73,68,
73,71,75,75,69)
dat2<-data.frame(strength,chemical)
dat2
## strength chemical
## 1 73 1
## 2 68 1
## 3 74 1
## 4 71 1
## 5 67 1
## 6 73 2
## 7 67 2
## 8 75 2
## 9 72 2
## 10 70 2
## 11 75 3
## 12 68 3
## 13 78 3
## 14 73 3
## 15 68 3
## 16 73 4
## 17 71 4
## 18 75 4
## 19 75 4
## 20 69 4
Linear Effects Model:
\[x_{ij}=\mu+\tau_{i}+\epsilon_{ij}\]
Null & Alternative Hypothesis:
\[H_{0}:\tau_{1}=\tau_{2}=...=\tau_{i}=0 \text{ for all }i\]
\[H_{a}:\tau_{i}\neq0 \text{ for at least one }i \]
ANOVA
model_2<-lm(strength~chemical)
gad(model_2)
## $anova
## Analysis of Variance Table
##
## Response: strength
## Df Sum Sq Mean Sq F value Pr(>F)
## chemical 3 12.95 4.3167 0.3863 0.7644
## Residuals 16 178.80 11.1750
Chemical Critical Value
qf(0.85,3,16)
## [1] 2.031605
plot(model_2, which = (1:2))
Based on the QQ plot of the residuals and the residuals vs fitted blot, the data used in this CRD ANOVA test appears to be normally distributed with constant variance.
Based on the following two findings:
F test statistic = 0.3863 < critical value = 2.031605
P-value = 0.7644 > alpha = 0.15
Fail to reject the null hypothesis. There is insufficient evidence to indicate that the chemicals cause a difference to the mean tensile strength.
It is worth noting that the sum of squares for the chemical is identical in both questions (4.317). In the CRD (question 2), the bolt variation (SS = 157.0) is included in the error value. This raises MSE from 1.82 to 11.18 and essentially hides the effect of the chemical.
Bolt effects account for a large quantity of the total sum of squares (~82%), so it is a large source of nuisance variability. Blocking on it was necessary to detect the chemical effect.
# Question 1
library(GAD)
chemical<-as.fixed(rep(1:4,each = 5))
bolt<-as.random(rep(1:5,times = 4))
strength <- c(73,68,74,71,67,
73,67,75,72,70,
75,68,78,73,68,
73,71,75,75,69)
dat<-data.frame(strength,chemical,bolt)
dat
model_1<-lm(strength~chemical+bolt)
gad(model_1)
ccv<-qf(0.85,3,12)
ccv
bcv<-qf(0.85,4,12)
bcv
plot(model_1, which = (1:2))
# Question 2
chemical<-as.fixed(rep(1:4,each = 5))
strength <- c(73,68,74,71,67,
73,67,75,72,70,
75,68,78,73,68,
73,71,75,75,69)
dat2<-data.frame(strength,chemical)
dat2
model_2<-lm(strength~chemical)
gad(model_2)
qf(0.85,3,16)
plot(model_2, which = (1:2))