library(DoE.base)
A <- rep(c(-1,1), times=4)
B <- rep(c(-1,-1,1,1), times=2)
C <- rep(c(-1,-1,-1,-1,1,1,1,1))
Treatment <- c("(1)","a","b","ab","c","ac","bc","abc")
ToolLife <- c(22,32,35,55,44,40,60,39)
dat <- data.frame(Treatment,A,B,C,ToolLife)
dat
## Treatment A B C ToolLife
## 1 (1) -1 -1 -1 22
## 2 a 1 -1 -1 32
## 3 b -1 1 -1 35
## 4 ab 1 1 -1 55
## 5 c -1 -1 1 44
## 6 ac 1 -1 1 40
## 7 bc -1 1 1 60
## 8 abc 1 1 1 39
For a \(2^3\) factorial design, there are 8 treatment combinations.
With two blocks, each block contains 4 observations. We confound the highest-order interaction, ABC, with blocks to preserve the main effects and two-factor interactions.
dat$ABC <- dat$A*dat$B*dat$C
dat$Block2 <- factor(dat$ABC,levels=c(-1,1),labels=c("Block 1","Block 2"))
dat[order(dat$Block2),]
## Treatment A B C ToolLife ABC Block2
## 1 (1) -1 -1 -1 22 -1 Block 1
## 4 ab 1 1 -1 55 -1 Block 1
## 6 ac 1 -1 1 40 -1 Block 1
## 7 bc -1 1 1 60 -1 Block 1
## 2 a 1 -1 -1 32 1 Block 2
## 3 b -1 1 -1 35 1 Block 2
## 5 c -1 -1 1 44 1 Block 2
## 8 abc 1 1 1 39 1 Block 2
split(dat$Treatment,dat$Block2)
## $`Block 1`
## [1] "(1)" "ab" "ac" "bc"
##
## $`Block 2`
## [1] "a" "b" "c" "abc"
Block 1: (1), ab, ac, bc
Block 2: a, b, c, abc
The treatments are randomized within each block.
With four blocks, each block contains 2 observations.
Choosing two independent block generators:
\[g_1=AB,\qquad g_2=AC\]
Multiplying them:
\[(AB)(AC)=A^2BC=BC\]
Therefore, the effects confounded with blocks are AB, AC, and BC.
dat$AB <- dat$A*dat$B
dat$AC <- dat$A*dat$C
dat$Block4 <- factor(c(1,2,3,4,4,3,2,1))
dat[order(dat$Block4),]
## Treatment A B C ToolLife ABC Block2 AB AC Block4
## 1 (1) -1 -1 -1 22 -1 Block 1 1 1 1
## 8 abc 1 1 1 39 1 Block 2 1 1 1
## 2 a 1 -1 -1 32 1 Block 2 -1 -1 2
## 7 bc -1 1 1 60 -1 Block 1 -1 -1 2
## 3 b -1 1 -1 35 1 Block 2 -1 1 3
## 6 ac 1 -1 1 40 -1 Block 1 -1 1 3
## 4 ab 1 1 -1 55 -1 Block 1 1 -1 4
## 5 c -1 -1 1 44 1 Block 2 1 -1 4
split(dat$Treatment,dat$Block4)
## $`1`
## [1] "(1)" "abc"
##
## $`2`
## [1] "a" "bc"
##
## $`3`
## [1] "b" "ac"
##
## $`4`
## [1] "ab" "c"
table(dat$Block4)
##
## 1 2 3 4
## 2 2 2 2
The proposed design is:
Each block contains two treatment combinations.
# Full Factorial Model
model1 <- lm(ToolLife ~ A*B*C, data=dat)
coef(model1)
## (Intercept) A B C A:B A:C
## 40.875 0.625 6.375 4.875 -0.875 -6.875
## B:C A:B:C
## -2.625 -3.375
# Estimate Factorial Effects
effects <- 2*coef(model1)[-1]
effects
## A B C A:B A:C B:C A:B:C
## 1.25 12.75 9.75 -1.75 -13.75 -5.25 -6.75
# Arrange Effects by Magnitude
sort(abs(effects),decreasing=TRUE)
## A:C B C A:B:C B:C A:B A
## 13.75 12.75 9.75 6.75 5.25 1.75 1.25
halfnormal(model1)
The estimated factorial effects are:
| Effect | Estimate |
|---|---|
| A | 1.25 |
| B | 12.75 |
| C | 9.75 |
| AB | -1.75 |
| AC | -13.75 |
| BC | -5.25 |
| ABC | -6.75 |
The largest effects are AC and B, followed by C.
Based on the half-normal plot, B and AC appear important, while C may also be important.
Because the experiment is unreplicated, these conclusions are tentative.
The ABC interaction is confounded with blocks.
# Mean Tool Life for Each Block
aggregate(ToolLife ~ Block2, data=dat, mean)
## Block2 ToolLife
## 1 Block 1 44.25
## 2 Block 2 37.50
# Exploratory ANOVA With Smaller Effects Pooled Into Error
model2 <- aov(ToolLife ~ B + C + A:C + ABC, data=dat)
summary(model2)
## Df Sum Sq Mean Sq F value Pr(>F)
## B 1 325.1 325.1 15.151 0.0301 *
## C 1 190.1 190.1 8.860 0.0588 .
## ABC 1 91.1 91.1 4.247 0.1314
## C:A 1 378.1 378.1 17.621 0.0247 *
## Residuals 3 64.4 21.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The block-associated ABC effect is -6.75.
Under the assumption that A, AB, and BC are negligible and can be pooled into error, the ABC effect has a p-value of approximately 0.1314. Since this is greater than 0.05, the block contrast does not appear statistically significant under this assumption.
However, ABC is completely confounded with blocks, so the experiment cannot distinguish the ABC interaction from the block effect independently.
In the two-block design, ABC is confounded with blocks.
In the four-block design, AB, AC, and BC are confounded with blocks.
The half-normal plot suggests that B and AC are important effects, with C potentially important. There is no strong evidence that blocking was significant, although the unreplicated design limits formal significance testing.
library(DoE.base)
A <- rep(c(-1,1), times=4)
B <- rep(c(-1,-1,1,1), times=2)
C <- rep(c(-1,-1,-1,-1,1,1,1,1))
Treatment <- c("(1)","a","b","ab","c","ac","bc","abc")
ToolLife <- c(22,32,35,55,44,40,60,39)
dat <- data.frame(Treatment,A,B,C,ToolLife)
dat
###Question 1
# (a) Confound ABC with Blocks
dat$ABC <- dat$A*dat$B*dat$C
# (b) Assign Treatments to Two Blocks
dat$Block2 <- factor(dat$ABC,levels=c(-1,1),labels=c("Block 1","Block 2"))
dat[order(dat$Block2),]
split(dat$Treatment,dat$Block2)
###Question 2
# (a) Confounded Effects AB, AC, and BC
dat$AB <- dat$A*dat$B
dat$AC <- dat$A*dat$C
# (b) Assign Treatments to Four Blocks
dat$Block4 <- factor(c(1,2,3,4,4,3,2,1))
dat[order(dat$Block4),]
split(dat$Treatment,dat$Block4)
table(dat$Block4)
###Question 3
# (a) Estimate Important Factorial Effects
model1 <- lm(ToolLife ~ A*B*C, data=dat)
coef(model1)
effects <- 2*coef(model1)[-1]
effects
sort(abs(effects),decreasing=TRUE)
halfnormal(model1)
# (b) Significance of Blocking
aggregate(ToolLife ~ Block2, data=dat, mean)
model2 <- aov(ToolLife ~ B + C + A:C + ABC, data=dat)
summary(model2)