An engineer is interested in the effects of cutting speed A, tool geometry B, and cutting angle C on the life (in hours) of a machine tool. Two levels of each factor are chosen, and three replicates of a 23 factorial design are run.
knitr::opts_chunk$set(echo = TRUE)
A<-rep(c(-1,1,-1,1,-1,1,-1,1),3)
B<-rep(c(-1,-1,1,1,-1,-1,1,1),3)
C<-rep(c(-1,-1,-1,-1,1,1,1,1),3)
rep1<-c(22,32,35,55,44,40,60,39)
rep2<-c(31,43,34,47,45,37,50,41)
rep3<-c(25,29,50,46,38,36,54,47)
rep<-c(rep1, rep2, rep3)
A<-as.fixed(A)
B<-as.fixed(B)
C<-as.fixed(C)
dat<-data.frame(A,B,C,rep)
dat
## A B C rep
## 1 -1 -1 -1 22
## 2 1 -1 -1 32
## 3 -1 1 -1 35
## 4 1 1 -1 55
## 5 -1 -1 1 44
## 6 1 -1 1 40
## 7 -1 1 1 60
## 8 1 1 1 39
## 9 -1 -1 -1 31
## 10 1 -1 -1 43
## 11 -1 1 -1 34
## 12 1 1 -1 47
## 13 -1 -1 1 45
## 14 1 -1 1 37
## 15 -1 1 1 50
## 16 1 1 1 41
## 17 -1 -1 -1 25
## 18 1 -1 -1 29
## 19 -1 1 -1 50
## 20 1 1 -1 46
## 21 -1 -1 1 38
## 22 1 -1 1 36
## 23 -1 1 1 54
## 24 1 1 1 47
mod<-lm(rep~A+B+C+A*B+B*C+A*C+A*B*C, data=dat)
gad(mod)
## Analysis of Variance Table
##
## Response: rep
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 0.67 0.67 0.0221 0.8836803
## B 1 770.67 770.67 25.5470 0.0001173 ***
## C 1 280.17 280.17 9.2873 0.0076787 **
## A:B 1 16.67 16.67 0.5525 0.4680784
## B:C 1 48.17 48.17 1.5967 0.2244753
## A:C 1 468.17 468.17 15.5193 0.0011722 **
## A:B:C 1 28.17 28.17 0.9337 0.3482825
## Residual 16 482.67 30.17
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coef(mod)
## (Intercept) A1 B1 C1 A1:B1 B1:C1
## 26.000000 8.666667 13.666667 16.333333 1.000000 -1.333333
## A1:C1 A1:B1:C1
## -13.333333 -8.666667
ABC interaction was removed since it is not significant.
mod<-lm(rep~A+B+C+A*B+B*C+A*C, data=dat)
gad(mod)
## Analysis of Variance Table
##
## Response: rep
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 0.67 0.67 0.0222 0.883346
## B 1 770.67 770.67 25.6470 9.581e-05 ***
## C 1 280.17 280.17 9.3237 0.007186 **
## A:B 1 16.67 16.67 0.5546 0.466596
## B:C 1 48.17 48.17 1.6029 0.222563
## A:C 1 468.17 468.17 15.5801 0.001040 **
## Residual 17 510.83 30.05
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coef(mod)
## (Intercept) A1 B1 C1 A1:B1 B1:C1
## 24.916667 10.833333 15.833333 18.500000 -3.333333 -5.666667
## A1:C1
## -17.666667
BC interaction was removed since it is not significant.
mod<-lm(rep~A+B+C+A*B+A*C, data=dat)
gad(mod)
## Analysis of Variance Table
##
## Response: rep
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 0.67 0.67 0.0215 0.885143
## B 1 770.67 770.67 24.8157 9.663e-05 ***
## C 1 280.17 280.17 9.0215 0.007626 **
## A:B 1 16.67 16.67 0.5367 0.473247
## A:C 1 468.17 468.17 15.0751 0.001091 **
## Residual 18 559.00 31.06
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coef(mod)
## (Intercept) A1 B1 C1 A1:B1 A1:C1
## 26.333333 10.833333 13.000000 15.666667 -3.333333 -17.666667
AB interaction was removed since it is not significant.
mod<-lm(rep~A+B+C+A*C, data=dat)
gad(mod)
## Analysis of Variance Table
##
## Response: rep
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 0.67 0.67 0.022 0.8836408
## B 1 770.67 770.67 25.436 7.216e-05 ***
## C 1 280.17 280.17 9.247 0.0067238 **
## A:C 1 468.17 468.17 15.452 0.0008972 ***
## Residual 19 575.67 30.30
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coef(mod)
## (Intercept) A1 B1 C1 A1:C1
## 27.166667 9.166667 11.333333 15.666667 -17.666667
Significant factors: B & C and the AC interaction where A: Cutting speed, B: Tool geometry, AC: Cutting speed and Cutting angle
In a process development study on yield, four factors were studied, each at two levels: time (A), concentration (B), pressure (C), and temperature (D). Due to constraints on sampling, only a single replicate of the design may be run. What factors appear to be significant in determining the mean yield?
A1<-rep(c(-1,1), 8)
B1<-rep(c(-1,-1,1,1), 4)
C1<-rep(c(-1,-1,-1,-1,1,1,1,1),2)
D1<-c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1)
rep4<-c(12,18,13,16,17,15,20,15,10,25,13,24,19,21,17,23)
mod<-lm(rep4~A1+B1+C1+D1+
A1*B1+B1*C1+
A1*C1+A1*D1+B1*D1+C1*D1+A1*B1*C1+
A1*B1*D1+A1*C1*D1+B1*C1*D1+
A1*B1*C1*D1, data=dat)
coef(mod)
## (Intercept) A1 B1 C1 D1
## 1.737500e+01 2.250000e+00 2.500000e-01 1.000000e+00 1.625000e+00
## A1:B1 B1:C1 A1:C1 A1:D1 B1:D1
## -3.750000e-01 1.250000e-01 -2.125000e+00 2.000000e+00 -2.393918e-16
## C1:D1 A1:B1:C1 A1:B1:D1 A1:C1:D1 B1:C1:D1
## -2.012279e-16 5.000000e-01 3.750000e-01 -1.250000e-01 -3.750000e-01
## A1:B1:C1:D1
## 5.000000e-01
halfnormal(mod, main="Half normal plot for yield study")
##
## Significant effects (alpha=0.05, Lenth method):
## [1] A1 A1:C1 A1:D1 D1
Significant effects A1: time, D1: temperature, and interactions A1:C1::time:pressure, A1:D1::time:temperature
#Flipped Assignment 9
#Group 5
#Question 1
install.packages("GAD")
library(DoE.base)
library(GAD)
A<-rep(c(-1,1,-1,1,-1,1,-1,1),3)
B<-rep(c(-1,-1,1,1,-1,-1,1,1),3)
C<-rep(c(-1,-1,-1,-1,1,1,1,1),3)
rep1<-c(22,32,35,55,44,40,60,39)
rep2<-c(31,43,34,47,45,37,50,41)
rep3<-c(25,29,50,46,38,36,54,47)
rep<-c(rep1, rep2, rep3)
A<-as.fixed(A)
B<-as.fixed(B)
C<-as.fixed(C)
dat<-data.frame(A,B,C,rep)
dat
mod<-lm(rep~A+B+C+A*B+B*C+A*C+A*B*C, data=dat)
gad(mod)
coef(mod)
mod<-lm(rep~A+B+C+A*B+B*C+A*C, data=dat)
gad(mod)
coef(mod)
mod<-lm(rep~A+B+C+A*B+A*C, data=dat)
gad(mod)
coef(mod)
mod<-lm(rep~A+B+C+A*C, data=dat)
gad(mod)
coef(mod)
#Significant factors: B y C and the AC interaction where A: Cutting speed,
#B: Tool geometry, C: Cutting speed and Cutting angle
#Question 2
A1<-rep(c(-1,1), 8)
B1<-rep(c(-1,-1,1,1), 4)
C1<-rep(c(-1,-1,-1,-1,1,1,1,1),2)
D1<-c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1)
rep4<-c(12,18,13,16,17,15,20,15,10,25,13,24,19,21,17,23)
dat1<-data.frame(A1,B1,C1,D1,rep4)
dat1
mod<-lm(rep4~A1+B1+C1+D1+
A1*B1+B1*C1+
A1*C1+A1*D1+B1*D1+C1*D1+A1*B1*C1+
A1*B1*D1+A1*C1*D1+B1*C1*D1+
A1*B1*C1*D1, data=dat)
coef(mod)
halfnormal(mod, main="Half normal plot for yield study")
?halfnormal #Single replicate
#Significant effects A1: time, D1: temperature, and interactions A1:C1::time:pressure, A1:D1::time:temperature