5a.
#True - An interaction effect in the model from a factorial experiment involving quantitative factors is a way of incorporating curvature into the response surface model representation of the results.
5b
#True-A factorial experiment may be conducted as a RCBD by running each replicate of the experiment in a unique block.c
5c
# True - If an interaction effect in a factorial experiment is significant, the main effects of the factors involved in that interaction are difficult to interpret individually.
5d
#a.
# Ho: No term in the model is associated with the response (covariates, blocks, factor terms, and curvature).
# Ha: At least one term in the model is associated with the response (covariates, blocks, factor terms, and curvature)
# Since the p value>0.0904 in the row, We fail to reject Ho which means that no terms in the model is associated to y.
#b.
# A is associated with the response (p-value < 0.05), and B is not associated with the response (p-value > 0.05)
#c. 3 levels
#d.
# With 11 total degrees of freedom, a total of 12 runs were made. Therefore, two replicates were made for each experimental run.
#5
#a. Complete the ANOVA calculations
# Source SS DF MS F
# A 50.00 1 50.00 50
# B 80.00 2 40.00 40
# AB 30.00 2 15.00 15
# Error 12.00 12 1.00
# Total 172.00 17
#b Since the F-values for the main effects and interaction effects are large, we can conclude that the main effect and interaction effects are significant.
#c True
#6.
#Two-way ANOVA: y versus A, B
#Source DF SS MS F P
# A 1 0.0002 0.0002 <0.0001 1.0
# B 3 180.378 60.126 3.03 0.1
# Interaction 3 8.479 2.83 0.142 0.9
# Error 8 158.797 19.85
# Total 15 347.653
#b. 4 levels
#c. 16/8 =2
#d. All terms are not associated with the response since pvalue is > 0.05
# Treatment A: Pressure(200,215 and 230)
# Treatment B: Temperature(150,160 and 170).
a= 3
b=3
n=2
y <- c(90.4,90.2,90.7,90.6,90.2,90.4,90.1,90.3,90.5,90.6,89.9,90.1,
90.5,90.7,90.8,90.9,90.4,90.1)
A <- factor(rep(c(rep("200",n),rep("215",n),rep("230",n)),3))
B <- factor(c(rep("150",3*n),rep("160",3*n),rep("170",3*n)))
X <- data.frame(y,A,B)
## main effects model
model <- aov(y~A*B)
anova(model)
## Analysis of Variance Table
##
## Response: y
## Df Sum Sq Mean Sq F value Pr(>F)
## A 2 0.76778 0.38389 21.5937 0.0003673 ***
## B 2 0.30111 0.15056 8.4687 0.0085392 **
## A:B 4 0.06889 0.01722 0.9687 0.4700058
## Residuals 9 0.16000 0.01778
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Only the main effects are significant.
#b.
qqnorm(model$residuals)
qqline(model$residuals)
shapiro.test(model$residuals)
##
## Shapiro-Wilk normality test
##
## data: model$residuals
## W = 0.87366, p-value = 0.02046
plot(model$fitted.values,model$residuals)
abline(h=0)
# Normality fails! I will check in with Professor Viles.
#c When both temperature and pressure are in a feasible range of ops.
#8
# treatment A (Depth of cut)
a <- 4
# treatment B(Feed rate)
b <- 3
# Number of relicates
n=3
# response variable
y <- c(74,64,60,79,68,73,82,88,92,99,104,96,
92,86,88,98,104,88,99,108,95,104,110,99,
99,98,102,104,99,95,108,110,99,114,111,107)
# factor variables
A <- factor(rep(c(rep("0.15",3),rep("0.18",3),rep("0.20",3),rep("0.25",3)),3))
B <- factor(c(rep("0.20",4*n),rep("0.25",4*n),rep("0.30",4*n)))
X <- data.frame(y,A,B)
model <- aov(y~A*B)
anova(model)
## Analysis of Variance Table
##
## Response: y
## Df Sum Sq Mean Sq F value Pr(>F)
## A 3 2125.11 708.37 24.6628 1.652e-07 ***
## B 2 3160.50 1580.25 55.0184 1.086e-09 ***
## A:B 6 557.06 92.84 3.2324 0.01797 *
## Residuals 24 689.33 28.72
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# The main effects and interaction effects are associated with the response (p-value<0.05)
#b.
qqnorm(model$residuals)
qqline(model$residuals)
plot(model$fitted.values,model$residuals)
abline(h=0)
shapiro.test(model$residuals)
##
## Shapiro-Wilk normality test
##
## data: model$residuals
## W = 0.97051, p-value = 0.4397
# Critical assumptions met!
#c.
# mean surface at each feed rate:
c(mean(y[B=="0.20"]),mean(y[B=="0.25"]),mean(y[B=="0.30"]))
## [1] 81.58333 97.58333 103.83333
#d in table
11
# Treatment A (Production machines)
a <- 4
# Treatment B (Operators)
b <- 3
# no of replicates
n <- 2
y <- c(109,110,110,115,108,109,110,108,
110,112,110,111,111,109,114,112,
116,114,112,115,114,119,120,117)
A <- factor(rep(c(rep("m1",n),rep("m2",n),rep("m3",n),rep("m4",n)),3))
B <- factor(c(rep("O1",4*n),rep("O2",4*n),rep("O3",4*n)))
X <- data.frame(y,A,B)
model <- aov(y~A*B)
anova(model)
## Analysis of Variance Table
##
## Response: y
## Df Sum Sq Mean Sq F value Pr(>F)
## A 3 12.458 4.153 1.0952 0.3887526
## B 2 160.333 80.167 21.1429 0.0001167 ***
## A:B 6 44.667 7.444 1.9634 0.1506807
## Residuals 12 45.500 3.792
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Only operators found to be associated with the response.
#b.
qqnorm(model$residuals)
qqline(model$residuals)
plot(model$fitted.values,model$residuals)
abline(h=0)
shapiro.test(model$residuals)
##
## Shapiro-Wilk normality test
##
## data: model$residuals
## W = 0.94926, p-value = 0.2611
#Critical assumptions met.
12
# Treatment A (Temperature)
a <- 3
# Treatment B (glass type)
b <- 3
n <- 3
y <- c(580,568,570,1090,1087,1085,1392,1380,1386,
550,530,579,1070,1035,1000,1328,1312,1299,
546,575,599,1045,1053,1066,867,904,889)
A <- factor(rep(c(rep("100",n),rep("125",n),rep("150",n)),3))
B <- factor(c(rep("type1",3*n),rep("type2",3*n),rep("type3",3*n)))
X <- data.frame(y,A,B)
model <- aov(y~A*B)
anova(model)
## Analysis of Variance Table
##
## Response: y
## Df Sum Sq Mean Sq F value Pr(>F)
## A 2 1970335 985167 2695.26 < 2.2e-16 ***
## B 2 150865 75432 206.37 3.886e-13 ***
## A:B 4 290552 72638 198.73 1.254e-14 ***
## Residuals 18 6579 366
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# All main effects and interaction effects are related to response.
qqnorm(model$residuals)
qqline(model$residuals)
plot(model$fitted.values,model$residuals)
abline(h=0)
shapiro.test(model$residuals)
##
## Shapiro-Wilk normality test
##
## data: model$residuals
## W = 0.96695, p-value = 0.5237
#Critical assumptions met.
19
#Results provided in class.
21
# treatment A(Operators)
a <- 3
# treatment B(Cycle time)
b <- 3
# treatment C(Temperature)
c <- 2
# NO OF replicates
n <- 3
y <- c(23,24,25,27,28,26,31,32,29,
36,35,36,34,38,39,33,34,35,
28,24,27,35,35,34,26,27,25,
24,23,28,38,36,35,34,36,39,
37,39,35,34,38,36,34,36,31,
26,29,25,36,37,34,28,26,24
)
A <- factor(rep(c(rep("o1",n),rep("o2",n),rep("o3",n)),c*b))
B <- factor(rep(c(rep("40",3*n),rep("50",3*n),rep("60",3*n)),2))
C <- factor(c(rep("t300",a*b*n),rep("t350",a*b*n)))
X <- data.frame(y,A,B,C)
model<- aov(y~A*B*C)
anova(model)
## Analysis of Variance Table
##
## Response: y
## Df Sum Sq Mean Sq F value Pr(>F)
## A 2 261.33 130.667 39.8644 7.439e-10 ***
## B 2 436.00 218.000 66.5085 8.141e-13 ***
## C 1 50.07 50.074 15.2768 0.0003934 ***
## A:B 4 355.67 88.917 27.1271 1.982e-10 ***
## A:C 2 11.26 5.630 1.7175 0.1938948
## B:C 2 78.81 39.407 12.0226 0.0001002 ***
## A:B:C 4 46.19 11.546 3.5226 0.0158701 *
## Residuals 36 118.00 3.278
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Expect the interaction between A and C, all other main terms and interactive terms are associated with the respone
## residuals
qqnorm(model$residuals)
qqline(model$residuals)
plot(model$fitted.values,model$residuals)
abline(h=0)
shapiro.test(model$residuals)
##
## Shapiro-Wilk normality test
##
## data: model$residuals
## W = 0.97742, p-value = 0.3978
26
# treatment A (anneal temperature)
a <- 3
# treatment B (polysilicon doping)
b <- 2
# replicates
n <- 2
#response variable
y <- c(4.6,4.4,10.15,10.2,11.01,10.58,
3.2,3.5,9.38,10.02,10.81,10.6)
# factor variables
A <- factor(rep(c(rep("900",n),rep("950",n),rep("1000",n)),2))
B <- factor(c(rep("1e20",3*n),rep("2e20",3*n)))
X <- data.frame(y,A,B)
model <- aov(y~A*B)
anova(model)
## Analysis of Variance Table
##
## Response: y
## Df Sum Sq Mean Sq F value Pr(>F)
## A 2 111.188 55.594 865.1634 4.126e-08 ***
## B 1 0.980 0.980 15.2573 0.007928 **
## A:B 2 0.576 0.288 4.4805 0.064502 .
## Residuals 6 0.386 0.064
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# The main terms and interactive terms are associated with the response.
#b.
interaction.plot(x.factor=A,trace.factor=B,response=y,
fun=mean,type="b",col=c(2,3),
pch=c(19,15),fixed=TRUE,leg.bty="o",main="Interaction Plot")
#c.
qqnorm(model$residuals)
qqline(model$residuals)
plot(model$fitted.values,model$residuals)
abline(h=0)
#Critical Assumptions met.
#d - Will ask Professor Viles in Class.