In a process development study on yield, four factors were studied, each at two levels: time (A), concentration (B), pressure (C), and temperature (D).
| A | B | C | D | yield |
|---|---|---|---|---|
| - | - | - | - | 12 |
| + | - | - | - | 18 |
| - | + | - | - | 13 |
| + | + | - | - | 16 |
| - | - | + | - | 17 |
| + | - | + | - | 15 |
| - | + | + | - | 20 |
| + | + | + | - | 15 |
| - | - | - | + | 10 |
| + | - | - | + | 25 |
| - | + | - | + | 13 |
| + | + | - | + | 24 |
| - | - | + | + | 19 |
| + | - | + | + | 21 |
| - | + | + | + | 17 |
| + | + | + | + | 23 |
A <- c(-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1)
B <- c(-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1)
C <- c(-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1)
D <- c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1)
yield <- c(12,18,13,16,17,15,20,15,10,25,13,24,19,21,17,23)
dat <- data.frame(A,B,C,D,yield)
mod1 <- lm(yield~A*B*C*D,data=dat)
Display the half-normal plot for this data and determine which factors appear to be significant.
halfnormal(mod1)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] A A:C A:D D
Based on the half normal plot, factors D,AxD,AxC, and A are significant since higher order effect terms include C, will be pulled into model as well, but not going to explicitly state it.
Pull terms that do not appear to be significant into error and test for the significance of the other effects at the 0.05 level of significance.
#make them factors so we can do anova
A <- as.factor(c(-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1))
B <- as.factor(c(-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1))
C <- as.factor(c(-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1))
D <- as.factor(c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1))
dat <- data.frame(A,B,C,D,yield)
aov1 <- aov(yield~A+D+A*C+A*D,data = dat)
summary(aov1)
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 81.00 81.00 49.846 3.46e-05 ***
## D 1 42.25 42.25 26.000 0.000465 ***
## C 1 16.00 16.00 9.846 0.010549 *
## A:C 1 72.25 72.25 44.462 5.58e-05 ***
## A:D 1 64.00 64.00 39.385 9.19e-05 ***
## Residuals 10 16.25 1.62
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#just to prove that these are the same
aov2 <- aov(yield~A+C+D+A*C+A*D,data = dat)
summary(aov2)
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 81.00 81.00 49.846 3.46e-05 ***
## C 1 16.00 16.00 9.846 0.010549 *
## D 1 42.25 42.25 26.000 0.000465 ***
## A:C 1 72.25 72.25 44.462 5.58e-05 ***
## A:D 1 64.00 64.00 39.385 9.19e-05 ***
## Residuals 10 16.25 1.63
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
All of the remaining effects are significant at the alpha = .05 level
Below you will find a block containing all of the code used to generate this document
A <- c(-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1)
B <- c(-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1)
C <- c(-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1)
D <- c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1)
yield <- c(12,18,13,16,17,15,20,15,10,25,13,24,19,21,17,23)
dat <- data.frame(A,B,C,D,yield)
mod1 <- lm(yield~A*B*C*D,data=dat)
#Part A
halfnormal(mod1)
#Part B
A <- as.factor(c(-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1))
B <- as.factor(c(-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1))
C <- as.factor(c(-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1))
D <- as.factor(c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1))
dat <- data.frame(A,B,C,D,yield)
aov1 <- aov(yield~A+D+A*C+A*D,data = dat)
summary(aov1)
aov2 <- aov(yield~A+C+D+A*C+A*D,data = dat)
summary(aov2)