Entering and sorting data:
library(DoE.base)
## Warning: package 'DoE.base' was built under R version 4.1.3
## Loading required package: grid
## Loading required package: conf.design
## Registered S3 method overwritten by 'DoE.base':
## method from
## factorize.factor conf.design
##
## Attaching package: 'DoE.base'
## The following objects are masked from 'package:stats':
##
## aov, lm
## The following object is masked from 'package:graphics':
##
## plot.design
## The following object is masked from 'package:base':
##
## lengths
A <- rep(c(-1,1),8)
B <- rep(c(-1,-1,1,1),4)
C <- rep(c(rep(-1,4), rep(1,4)),2)
D <- c(rep(-1,8), rep(1,8))
obs11 <- c(12,
18,
13,
20,
17,
25,
15,
25,
10,
24,
13,
24,
19,
21,
17,
23
)
The halfnormal plot is shown as follows:
model11 <- lm(obs11~A*B*C*D)
halfnormal(model11)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] A C A:C:D
From the half-normal plot, we observe that the main factor A and C are significant. Also, the 3-way interaction between the factors A,C, and D is also important.
So, based on our previous calculation, we create the following model:
yijkl = mu + ai +bj + ck +abcijk + eijkl
Where, mu = grand mean
ai = main effect of factor A
bj = main effect of factor C
ck = main effect of factor D
abcijk = 3-way interaction between factor A,C,D
eijkl = random error
Null hypothesis: Ho: ai = 0,
bj = 0,
ck = 0,
abcijk = 0
Alternative hypothesis: Ha: ai ≠ 0,
bj ≠ 0,,
ck ≠ 0,,
abcijk ≠ 0
From ANOVA analysis we have:
model11mod <- aov(obs11~A+C+D+A*C*D)
summary(model11mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 256.00 256.00 157.538 1.52e-06 ***
## C 1 49.00 49.00 30.154 0.00058 ***
## D 1 2.25 2.25 1.385 0.27314
## A:C 1 9.00 9.00 5.538 0.04643 *
## A:D 1 0.25 0.25 0.154 0.70513
## C:D 1 6.25 6.25 3.846 0.08550 .
## A:C:D 1 30.25 30.25 18.615 0.00256 **
## Residuals 8 13.00 1.63
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From ANOVA, we have:
main effect p-values for A and C less than the level of signifcance of alpha = 0.05. Hence we reject the null hypothesis and conclude that A and C have significant effects.
Also, we conclude that Two-way interaction A and C and 3-way interaction between A,C,D are significant as their p-value is less than the level of significance of alpha = 0.05.
All other main factors and interactions are insignificant.
Complete code chunk:
library(DoE.base)
A <- rep(c(-1,1),8)
B <- rep(c(-1,-1,1,1),4)
C <- rep(c(rep(-1,4), rep(1,4)),2)
D <- c(rep(-1,8), rep(1,8))
obs11 <- c(12,
18,
13,
20,
17,
25,
15,
25,
10,
24,
13,
24,
19,
21,
17,
23
)
model11 <- lm(obs11~A*B*C*D)
halfnormal(model11)
model11mod <- aov(obs11~A+C+D+A*C*D)
summary(model11mod)