Answer 6.8

Model Equation:

\(Y_{ijk}\) = \(\mu\) + \(\alpha_i\) + \(\beta_j\) + \(\alpha\beta_{ij}\) + \(\epsilon_{ijk}\)

Stating Hypothesis:

Interaction:

Null Hypothesis: \(\alpha\beta_{ij} = 0\)

Alternative Hypothesis: \(\alpha\beta_{ij} \neq 0\)

Main Effect: (Factor A)

Null Hypothesis: \(\alpha_i = 0\) For all i

Alternative Hypothesis: \(\alpha_i \neq 0\) for some i

Null Hypothesis: \(\beta_j = 0\) (Factor B)

Alternative Hypothesis: \(\beta_j \neq 0\) for some j

CultureMedium <-  c(1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2)
Time <- c(rep(12,12),rep(18,12))
Values <- c(21,22,25,26,23,28,24,25,20,26,29,27,37,39,31,34,38,38,29,33,35,36,30,35)
interaction.plot(CultureMedium,Time,Values)

Above is the interaction plot for the significant factors.

Time <- as.fixed(Time)
CultureMedium <- as.fixed(CultureMedium)
Dat1 <- data.frame (Time, CultureMedium, Values)

Dat.Model6.8 <- lm(Values~Time*CultureMedium, data = Dat1)
Dat.Model6.8b <- aov(Dat.Model6.8)
summary(Dat.Model6.8b)
##                    Df Sum Sq Mean Sq F value   Pr(>F)    
## Time                1  590.0   590.0 115.506 9.29e-10 ***
## CultureMedium       1    9.4     9.4   1.835 0.190617    
## Time:CultureMedium  1   92.0    92.0  18.018 0.000397 ***
## Residuals          20  102.2     5.1                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(Dat.Model6.8b)

The residuals & the normal probablility plots show that the data is fairly normally distributed but the variance has a slight funnel shape so the model isn’t adequate.

Hence, the p values for Time = 0.190617 > alpha = 0.05, hence we fail to reject the null hypothesis, and conclude that it is not significant. For CultureMedium p = 9.29e-10, Interaction of Time & CultureMedium = 0.000397, both of which are less than alpha = 0.05 and hence we reject the null hypothesis and conclude that they are significant.

Answer 6.12

Model Equation:

\(Y_{ijk}\) = \(\mu\) + \(\alpha_i\) + \(\beta_j\) + \(\alpha\beta_{ij}\) + \(\epsilon_{ijk}\)

Stating Hypothesis:

Interaction:

Null Hypothesis: \(\alpha\beta_{ij} = 0\)

Alternative Hypothesis: \(\alpha\beta_{ij} \neq 0\)

Main Effect:

Null Hypothesis: \(\alpha_i = 0\) For all i (Factor A)

Alternative Hypothesis: \(\alpha_i \neq 0\) for some i

Null Hypothesis: \(\beta_j = 0\) (Factor B)

Alternative Hypothesis: \(\beta_j \neq 0\) for some j

DepositionTime <- c(rep(-1,4),rep(-1,4),rep(1,4),rep(1,4))
ArsenicFlowRate  <- c(rep(-1,4),rep(1,4),rep(-1,4),rep(1,4))
Thickness <- c(14.037,16.165,13.972,13.907,13.880,13.860,14.032,13.914,14.821,14.757,14.843,14.878,14.888,14.921,14.415,14.932)

Dat2 <- data.frame(ArsenicFlowRate,DepositionTime,Thickness)

DepositionTime <- as.fixed(DepositionTime)
ArsenicFlowRate <- as.fixed(ArsenicFlowRate)

Dat.Model6.12 <- lm(Thickness~ArsenicFlowRate*DepositionTime, data = Dat2)
coef(Dat.Model6.12)
##                    (Intercept)                ArsenicFlowRate 
##                      14.513875                      -0.158625 
##                 DepositionTime ArsenicFlowRate:DepositionTime 
##                       0.293000                       0.140750

(a.) The factor effects estimates are:

Intercept = 14.513875

ArsenicFlowRate = -0.158625

DepositionTime = 0.293000

Interaction ArsenicFlowRate:DepositionTime = 0.140750

Dat.Model6.12b <- aov(Dat.Model6.12)
summary(Dat.Model6.12b)
##                                Df Sum Sq Mean Sq F value Pr(>F)  
## ArsenicFlowRate                 1  0.403  0.4026   1.262 0.2833  
## DepositionTime                  1  1.374  1.3736   4.305 0.0602 .
## ArsenicFlowRate:DepositionTime  1  0.317  0.3170   0.994 0.3386  
## Residuals                      12  3.828  0.3190                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(b.) Hence, the p values for ArsenicFlowRate = 0.2833, DepositionTime = 0.0602, Interaction of ArsenicFlowRate:DepositionTime = 0.3386 ; all of which are greater than alpha = 0.05 and hence we fail to reject the null hypothesis and conclude that they are not significant.

(c.) Regession Equation:

y (Thickness) = 14.513875 − 0.158625 (ArsenicFlowRate) + 0.293 (DepositionTime) + 0.14075 (Interaction) + Error

plot(Dat.Model6.12b)

## hat values (leverages) are all = 0.25
##  and there are no factor predictors; no plot no. 5

(d.) The plots show that the data is not normally distributed & also has an outlier, and also the variance is not constant so the model isn’t adequate.

(e.) In order to deal with the outlier found above, we can do a log transformation of the data and can decrease the value of our outlier and also fullfil our condition of constant variance. Also, there must have been an error in obtaining the data.

Answer 6.21

Typeofputter <- c(rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7))
LengthofPutt <- c(rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7))
Slopeofputt <- c(rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7))
Breakofputt <- c(rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7))

DistancefromCup <- c(10,18,14,12.5,19,16,18.5, 0,16.5,4.5,17.5,20.5,17.5,33, 4,6,1,14.5,12,14,5, 0,10,34,11,25.5,21.5,0, 0,0,18.5,19.5,16,15,11, 5,20.5,18,20,29.5,19,10, 6.5,18.5,7.5,6,0,10,0, 16.5,4.5,0,23.5,8,8,8, 4.5,18,14.5,10,0,17.5,6, 19.5,18,16,5.5,10,7,36, 15,16,8.5,0,0.5,9,3, 41.5,39,6.5,3.5,7,8.5,36, 8,4.5,6.5,10,13,41,14, 21.5,10.5,6.5,0,15.5,24,16, 0,0,0,4.5,1,4,6.5, 18,5,7,10,32.5,18.5,8) 

Typeofputter <- as.fixed(Typeofputter)
LengthofPutt <- as.fixed(LengthofPutt)
Slopeofputt <- as.fixed(Slopeofputt)
Breakofputt <- as.fixed(Breakofputt)

Dat3 <- data.frame(LengthofPutt, Typeofputter, Breakofputt, Slopeofputt, DistancefromCup)

We have read in the data above.

Dat.Model6.21 <- lm(DistancefromCup~LengthofPutt*Typeofputter*Breakofputt*Slopeofputt, data = Dat3)
coef(Dat.Model6.21)
##                                           (Intercept) 
##                                            15.4285714 
##                                         LengthofPutt1 
##                                             0.2142857 
##                                         Typeofputter1 
##                                            -7.3571429 
##                                          Breakofputt1 
##                                            -4.0000000 
##                                          Slopeofputt1 
##                                            -5.3571429 
##                           LengthofPutt1:Typeofputter1 
##                                             6.2857143 
##                            LengthofPutt1:Breakofputt1 
##                                             5.7857143 
##                            Typeofputter1:Breakofputt1 
##                                             2.8571429 
##                            LengthofPutt1:Slopeofputt1 
##                                             5.7142857 
##                            Typeofputter1:Slopeofputt1 
##                                             4.7142857 
##                             Breakofputt1:Slopeofputt1 
##                                             7.7857143 
##              LengthofPutt1:Typeofputter1:Breakofputt1 
##                                            -9.4285714 
##              LengthofPutt1:Typeofputter1:Slopeofputt1 
##                                             0.6428571 
##               LengthofPutt1:Breakofputt1:Slopeofputt1 
##                                           -12.1428571 
##               Typeofputter1:Breakofputt1:Slopeofputt1 
##                                           -11.7857143 
## LengthofPutt1:Typeofputter1:Breakofputt1:Slopeofputt1 
##                                            14.7857143
Dat.Model6.21a <- aov(Dat.Model6.21)
gad(Dat.Model6.21a)
## Analysis of Variance Table
## 
## Response: DistancefromCup
##                                                   Df Sum Sq Mean Sq F value
## LengthofPutt                                       1  917.1  917.15 10.5878
## Typeofputter                                       1  388.1  388.15  4.4809
## Breakofputt                                        1  145.1  145.15  1.6756
## Slopeofputt                                        1    1.4    1.40  0.0161
## LengthofPutt:Typeofputter                          1  218.7  218.68  2.5245
## LengthofPutt:Breakofputt                           1   11.9   11.90  0.1373
## Typeofputter:Breakofputt                           1  115.0  115.02  1.3278
## LengthofPutt:Slopeofputt                           1   93.8   93.81  1.0829
## Typeofputter:Slopeofputt                           1   56.4   56.43  0.6515
## Breakofputt:Slopeofputt                            1    1.6    1.63  0.0188
## LengthofPutt:Typeofputter:Breakofputt              1    7.3    7.25  0.0837
## LengthofPutt:Typeofputter:Slopeofputt              1  113.0  113.00  1.3045
## LengthofPutt:Breakofputt:Slopeofputt               1   39.5   39.48  0.4558
## Typeofputter:Breakofputt:Slopeofputt               1   33.8   33.77  0.3899
## LengthofPutt:Typeofputter:Breakofputt:Slopeofputt  1   95.6   95.65  1.1042
## Residual                                          96 8315.8   86.62        
##                                                     Pr(>F)   
## LengthofPutt                                      0.001572 **
## Typeofputter                                      0.036862 * 
## Breakofputt                                       0.198615   
## Slopeofputt                                       0.899280   
## LengthofPutt:Typeofputter                         0.115377   
## LengthofPutt:Breakofputt                          0.711776   
## Typeofputter:Breakofputt                          0.252054   
## LengthofPutt:Slopeofputt                          0.300658   
## Typeofputter:Slopeofputt                          0.421588   
## Breakofputt:Slopeofputt                           0.891271   
## LengthofPutt:Typeofputter:Breakofputt             0.772939   
## LengthofPutt:Typeofputter:Slopeofputt             0.256228   
## LengthofPutt:Breakofputt:Slopeofputt              0.501207   
## Typeofputter:Breakofputt:Slopeofputt              0.533858   
## LengthofPutt:Typeofputter:Breakofputt:Slopeofputt 0.295994   
## Residual                                                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(a.) As seen from the above half normal probability plot, the length of putt & type of putter seem to be the only factors that have a significant effect on the golf performance. Furthermore, we also see that the ANOVA results the p values for both the above factors is 0.001572 & 0.036862 respectively, hence we reject the null hypothesis and confirm with our conclusions as well.

plot(Dat.Model6.21a)

The above plots are for the residuals. Now let’s generate plots for only the significant factors:

Dat.Model6.21b <- lm(DistancefromCup~LengthofPutt*Typeofputter, data = Dat3)
plot(Dat.Model6.21b)

interaction.plot(LengthofPutt,Typeofputter,DistancefromCup)

### (b.) Therefore, we clearly see that in both the cases the NPP plot is not normal & has some outliers. Also the assumption of equality of variances is not satisfied in both sets of residual plots as well. so the model isn’t adequate.

Answer 6.36

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))

Resistivity<-c(1.92,11.28,1.09,5.75,2.13,9.53,1.03,5.35,1.60,11.73,1.16,4.68,2.16,9.11,1.07,5.30)

Dat4<-data.frame(A,B,C,D,Resistivity)
Dat4
##     A  B  C  D Resistivity
## 1  -1 -1 -1 -1        1.92
## 2   1 -1 -1 -1       11.28
## 3  -1  1 -1 -1        1.09
## 4   1  1 -1 -1        5.75
## 5  -1 -1  1 -1        2.13
## 6   1 -1  1 -1        9.53
## 7  -1  1  1 -1        1.03
## 8   1  1  1 -1        5.35
## 9  -1 -1 -1  1        1.60
## 10  1 -1 -1  1       11.73
## 11 -1  1 -1  1        1.16
## 12  1  1 -1  1        4.68
## 13 -1 -1  1  1        2.16
## 14  1 -1  1  1        9.11
## 15 -1  1  1  1        1.07
## 16  1  1  1  1        5.30

(a.) The Factor Effects:

Dat.Model6.36 <- lm(Resistivity~A*B*C*D, data=Dat4)
coef(Dat.Model6.36)
## (Intercept)           A           B           C           D         A:B 
##    4.680625    3.160625   -1.501875   -0.220625   -0.079375   -1.069375 
##         A:C         B:C         A:D         B:D         C:D       A:B:C 
##   -0.298125    0.229375   -0.056875   -0.046875    0.029375    0.344375 
##       A:B:D       A:C:D       B:C:D     A:B:C:D 
##   -0.096875   -0.010625    0.094375    0.141875
halfnormal(Dat.Model6.36)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A     B     A:B   A:B:C

We see that the significant effects are A, B, A:, and A:B:C.

The model eqn is Resistivity = 4.680625 + (3.160625)A + (-1.501875)B + (-1.069375)AB + Error

(b.) Residual for the effects:

Anew <- as.fixed(A)
Bnew <- as.fixed(B)
Dat4new <- data.frame(Anew,Bnew,Resistivity)
Dat.Model6.36b <- aov(Resistivity~Anew*Bnew, data=Dat4new)
GAD::gad(Dat.Model6.36b)
## Analysis of Variance Table
## 
## Response: Resistivity
##           Df  Sum Sq Mean Sq F value    Pr(>F)    
## Anew       1 159.833 159.833 333.088 4.049e-10 ***
## Bnew       1  36.090  36.090  75.211 1.630e-06 ***
## Anew:Bnew  1  18.297  18.297  38.130 4.763e-05 ***
## Residual  12   5.758   0.480                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(Dat.Model6.36b)

From the above plots we can see that in both the NPP plot is not normal, Also the assumption of equality of variances is not satisfied in residual plot so the model isn’t adequate.

(c.) Doing Ln(y) transformation for part (a.)

Lresistivity <- log(Resistivity)
Dat4c<-data.frame(A,B,C,D,Resistivity)

Dat.Model6.36c <- lm(Resistivity~A*B*C*D, data=Dat4c)
coef(Dat.Model6.36c)
## (Intercept)           A           B           C           D         A:B 
##    4.680625    3.160625   -1.501875   -0.220625   -0.079375   -1.069375 
##         A:C         B:C         A:D         B:D         C:D       A:B:C 
##   -0.298125    0.229375   -0.056875   -0.046875    0.029375    0.344375 
##       A:B:D       A:C:D       B:C:D     A:B:C:D 
##   -0.096875   -0.010625    0.094375    0.141875
halfnormal(Dat.Model6.36c)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A     B     A:B   A:B:C

We can conclude that apart from the main effects of A & B, ABC interaction looks to fairly all within the normality line, so we can no longer consider it as a significant effect.

Anewc <- as.fixed(A)
Bnewc <- as.fixed(B)
Dat4newc <- data.frame(Anewc,Bnewc,Lresistivity)
Dat.Model6.36bc <- aov(Lresistivity~Anewc+Bnewc, data=Dat4newc)
GAD::gad(Dat.Model6.36bc)
## Analysis of Variance Table
## 
## Response: Lresistivity
##          Df  Sum Sq Mean Sq F value    Pr(>F)    
## Anewc     1 10.5721 10.5721  962.95 1.408e-13 ***
## Bnewc     1  1.5803  1.5803  143.94 2.095e-08 ***
## Residual 13  0.1427  0.0110                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(Dat.Model6.36bc)

We can clearly see that the variances have stabilized a bit & also the NPP plot looks to be fairly normally distributed. The model seems to be adequate.

(c.) Doing Ln(y) transformation for part (b.)

Dat4newcb <- data.frame(Anew,Bnew,Lresistivity)
Dat.Model6.36bcb <- aov(Lresistivity~Anew+Bnew, data=Dat4newcb)
GAD::gad(Dat.Model6.36bcb)
## Analysis of Variance Table
## 
## Response: Lresistivity
##          Df  Sum Sq Mean Sq F value    Pr(>F)    
## Anew      1 10.5721 10.5721  962.95 1.408e-13 ***
## Bnew      1  1.5803  1.5803  143.94 2.095e-08 ***
## Residual 13  0.1427  0.0110                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(Dat.Model6.36bcb)

We can clearly see that the variances have stabilized a bit & also the NPP plot looks to be fairly normally distributed. The model seems to be adequate. Factors A & B seem to be significant as per their p-values.

Dat4d <- data.frame(Lresistivity,A,B)
Dat.Model6.36d <- lm(Lresistivity~A+B, data=Dat4d)
coef(Dat.Model6.36d)
## (Intercept)           A           B 
##   1.1854171   0.8128703  -0.3142776

(d.) The model in terms of the coded variables:

log(Resistivity) = 1.1854171 + (0.8128703)A + (-0.3142776)B + Error.

Answer 6.39

A<-rep(c(-1,1),16)
B<-rep(c(rep(-1,2),rep(1,2)),8)
C<-rep(c(rep(-1,4),rep(1,4)),4)
D<-rep(c(rep(-1,8),rep(1,8)),2)
E<-c(rep(-1,16),rep(1,16))
y<-c(8.11,5.56,5.77,5.82,9.17,7.8,3.23,5.69,8.82,14.23,9.2,8.94,8.68,11.49,6.25,9.12,7.93,5,7.47,12,9.86,3.65,6.4,11.61,12.43,17.55,8.87,25.38,13.08,18.85,11.78,26.05)
Dat5<-data.frame(A,B,C,D,E,y)
Dat5
##     A  B  C  D  E     y
## 1  -1 -1 -1 -1 -1  8.11
## 2   1 -1 -1 -1 -1  5.56
## 3  -1  1 -1 -1 -1  5.77
## 4   1  1 -1 -1 -1  5.82
## 5  -1 -1  1 -1 -1  9.17
## 6   1 -1  1 -1 -1  7.80
## 7  -1  1  1 -1 -1  3.23
## 8   1  1  1 -1 -1  5.69
## 9  -1 -1 -1  1 -1  8.82
## 10  1 -1 -1  1 -1 14.23
## 11 -1  1 -1  1 -1  9.20
## 12  1  1 -1  1 -1  8.94
## 13 -1 -1  1  1 -1  8.68
## 14  1 -1  1  1 -1 11.49
## 15 -1  1  1  1 -1  6.25
## 16  1  1  1  1 -1  9.12
## 17 -1 -1 -1 -1  1  7.93
## 18  1 -1 -1 -1  1  5.00
## 19 -1  1 -1 -1  1  7.47
## 20  1  1 -1 -1  1 12.00
## 21 -1 -1  1 -1  1  9.86
## 22  1 -1  1 -1  1  3.65
## 23 -1  1  1 -1  1  6.40
## 24  1  1  1 -1  1 11.61
## 25 -1 -1 -1  1  1 12.43
## 26  1 -1 -1  1  1 17.55
## 27 -1  1 -1  1  1  8.87
## 28  1  1 -1  1  1 25.38
## 29 -1 -1  1  1  1 13.08
## 30  1 -1  1  1  1 18.85
## 31 -1  1  1  1  1 11.78
## 32  1  1  1  1  1 26.05

Factor Effects:

Dat.Model6.39<-lm(y~A*B*C*D*E,data=Dat5)
coef(Dat.Model6.39)
## (Intercept)           A           B           C           D           E 
##  10.1809375   1.6153125   0.0428125  -0.0115625   2.9890625   2.1884375 
##         A:B         A:C         B:C         A:D         B:D         C:D 
##   1.2371875  -0.0021875  -0.1959375   1.6659375  -0.0140625   0.0040625 
##         A:E         B:E         C:E         D:E       A:B:C       A:B:D 
##   1.0265625   1.2828125   0.3021875   1.3903125   0.2509375  -0.3446875 
##       A:C:D       B:C:D       A:B:E       A:C:E       B:C:E       A:D:E 
##  -0.0640625   0.3046875   1.1859375  -0.2596875   0.1703125   0.9009375 
##       B:D:E       C:D:E     A:B:C:D     A:B:C:E     A:B:D:E     A:C:D:E 
##  -0.0403125   0.3965625  -0.0734375  -0.1840625   0.4078125   0.1271875 
##     B:C:D:E   A:B:C:D:E 
##  -0.0753125  -0.3546875
halfnormal(Dat.Model6.39)
## 
## Significant effects (alpha=0.05, Lenth method):
##  [1] D     E     A:D   A     D:E   B:E   A:B   A:B:E A:E   A:D:E

(a.) Hence, The significant factors are: D, E, A:D, A, D:E, B:E, A:B, A:B:E, A:E, A:D:E.

Residual Plots Generation:

A<-as.fixed(A)
B<-as.fixed(B)
D<-as.fixed(D)
E<-as.fixed(E)
Dat5b<-data.frame(A,B,D,E,y)
Dat.Model6.39b<-aov(y~A+B+D+E+A*B+B*E+D*E+A*D+A*E+A*B*E+A*D*E,data=Dat5b)
plot(Dat.Model6.39b)

(b.) The NPP plot shows the data to be fairly normally distributed. However, as per the residual v fitted plot the assumption of constant variance is not satisfied so the model is inadequate.

We can see that Factor C seems to be unimportant. SO now the design becomes a 2^4 one:

Dat5c<-data.frame(A,B,D,E,y)
Dat.Model6.39c<-aov(y~A*B*D*E,data=Dat5c)
GAD::gad(Dat.Model6.39c)
## Analysis of Variance Table
## 
## Response: y
##          Df  Sum Sq Mean Sq  F value    Pr(>F)    
## A         1  83.496  83.496  57.1573 1.146e-06 ***
## B         1   0.059   0.059   0.0402 0.8437099    
## D         1 285.904 285.904 195.7169 2.163e-10 ***
## E         1 153.256 153.256 104.9123 1.966e-08 ***
## A:B       1  48.980  48.980  33.5297 2.760e-05 ***
## A:D       1  88.811  88.811  60.7961 7.725e-07 ***
## B:D       1   0.006   0.006   0.0043 0.9483385    
## A:E       1  33.723  33.723  23.0850 0.0001945 ***
## B:E       1  52.659  52.659  36.0483 1.838e-05 ***
## D:E       1  61.855  61.855  42.3431 7.228e-06 ***
## A:B:D     1   3.802   3.802   2.6026 0.1262344    
## A:B:E     1  45.006  45.006  30.8093 4.389e-05 ***
## A:D:E     1  25.974  25.974  17.7806 0.0006552 ***
## B:D:E     1   0.052   0.052   0.0356 0.8527184    
## A:B:D:E   1   5.322   5.322   3.6432 0.0744042 .  
## Residual 16  23.373   1.461                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(c.) We can see that the same factors continue to be significant as from the original model factor effects.

Dat.Model6.39d<-lm(y~A+B+D+E,data=Dat5)
coef(Dat.Model6.39d)
## (Intercept)           A           B           D           E 
##  10.1809375   1.6153125   0.0428125   2.9890625   2.1884375

(d.) The model eqn of the active factors that maximize the predicted response:

y = 10.1809375 + (1.6153125)A + (0.0428125)B + (2.9890625)D + (2.1884375)E + Error.

We can see that the coefficients are positive in all the factors, hence they will maximize the predicted response.

Source Code:

library(GAD)
library(DoE.base)

CultureMedium <-  c(1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2)
Time <- c(rep(12,12),rep(18,12))
Values <- c(21,22,25,26,23,28,24,25,20,26,29,27,37,39,31,34,38,38,29,33,35,36,30,35)

interaction.plot(CultureMedium,Time,Values)

Time <- as.fixed(Time)
CultureMedium <- as.fixed(CultureMedium)
Dat1 <- data.frame (Time, CultureMedium, Values)

Dat.Model6.8 <- lm(Values~Time*CultureMedium, data = Dat1)
Dat.Model6.8b <- aov(Dat.Model6.8)
summary(Dat.Model6.8b)
plot(Dat.Model6.8b)

DepositionTime <- c(rep(-1,4),rep(-1,4),rep(1,4),rep(1,4))
ArsenicFlowRate  <- c(rep(-1,4),rep(1,4),rep(-1,4),rep(1,4))
Thickness <- c(14.037,16.165,13.972,13.907,13.880,13.860,14.032,13.914,14.821,14.757,14.843,14.878,14.888,14.921,14.415,14.932)

Dat2 <- data.frame(ArsenicFlowRate,DepositionTime,Thickness)

DepositionTime <- as.fixed(DepositionTime)
ArsenicFlowRate <- as.fixed(ArsenicFlowRate)

Dat.Model6.12 <- lm(Thickness~ArsenicFlowRate*DepositionTime, data = Dat2)
coef(Dat.Model6.12)

Dat.Model6.12b <- aov(Dat.Model6.12)
summary(Dat.Model6.12b)

plot(Dat.Model6.12b)


Typeofputter <- c(rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7))
LengthofPutt <- c(rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7),rep(-1,7),rep(1,7))
Slopeofputt <- c(rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7))
Breakofputt <- c(rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(-1,7),rep(1,7),rep(1,7),rep(1,7),rep(1,7))

DistancefromCup <- c(10,18,14,12.5,19,16,18.5, 0,16.5,4.5,17.5,20.5,17.5,33, 4,6,1,14.5,12,14,5, 0,10,34,11,25.5,21.5,0, 0,0,18.5,19.5,16,15,11, 5,20.5,18,20,29.5,19,10, 6.5,18.5,7.5,6,0,10,0, 16.5,4.5,0,23.5,8,8,8, 4.5,18,14.5,10,0,17.5,6, 19.5,18,16,5.5,10,7,36, 15,16,8.5,0,0.5,9,3, 41.5,39,6.5,3.5,7,8.5,36, 8,4.5,6.5,10,13,41,14, 21.5,10.5,6.5,0,15.5,24,16, 0,0,0,4.5,1,4,6.5, 18,5,7,10,32.5,18.5,8) 

Typeofputter <- as.fixed(Typeofputter)
LengthofPutt <- as.fixed(LengthofPutt)
Slopeofputt <- as.fixed(Slopeofputt)
Breakofputt <- as.fixed(Breakofputt)

Dat3 <- data.frame(LengthofPutt, Typeofputter, Breakofputt, Slopeofputt, DistancefromCup)

Dat.Model6.21 <- lm(DistancefromCup~LengthofPutt*Typeofputter*Breakofputt*Slopeofputt, data = Dat3)
coef(Dat.Model6.21)

Dat.Model6.21a <- aov(Dat.Model6.21)
gad(Dat.Model6.21a)

plot(Dat.Model6.21a)

Dat.Model6.21b <- lm(DistancefromCup~LengthofPutt*Typeofputter, data = Dat3)
plot(Dat.Model6.21b)
interaction.plot(LengthofPutt,Typeofputter,DistancefromCup)

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))

Resistivity<-c(1.92,11.28,1.09,5.75,2.13,9.53,1.03,5.35,1.60,11.73,1.16,4.68,2.16,9.11,1.07,5.30)

Dat4<-data.frame(A,B,C,D,Resistivity)
Dat4

Dat.Model6.36 <- lm(Resistivity~A*B*C*D, data=Dat4)
coef(Dat.Model6.36)
halfnormal(Dat.Model6.36)

Anew <- as.fixed(A)
Bnew <- as.fixed(B)
Dat4new <- data.frame(Anew,Bnew,Resistivity)
Dat.Model6.36b <- aov(Resistivity~Anew*Bnew, data=Dat4new)
GAD::gad(Dat.Model6.36b)
plot(Dat.Model6.36b)

Lresistivity <- log(Resistivity)
Dat4c<-data.frame(A,B,C,D,Resistivity)

Dat.Model6.36c <- lm(Resistivity~A*B*C*D, data=Dat4c)
coef(Dat.Model6.36c)
halfnormal(Dat.Model6.36c)

Anewc <- as.fixed(A)
Bnewc <- as.fixed(B)
Dat4newc <- data.frame(Anewc,Bnewc,Lresistivity)
Dat.Model6.36bc <- aov(Lresistivity~Anewc+Bnewc, data=Dat4newc)
GAD::gad(Dat.Model6.36bc)
plot(Dat.Model6.36bc)

Dat4newcb <- data.frame(Anew,Bnew,Lresistivity)
Dat.Model6.36bcb <- aov(Lresistivity~Anew+Bnew, data=Dat4newcb)
GAD::gad(Dat.Model6.36bcb)
plot(Dat.Model6.36bcb)

Dat4d <- data.frame(Lresistivity,A,B)
Dat.Model6.36d <- lm(Lresistivity~A+B, data=Dat4d)
coef(Dat.Model6.36d)

A<-rep(c(-1,1),16)
B<-rep(c(rep(-1,2),rep(1,2)),8)
C<-rep(c(rep(-1,4),rep(1,4)),4)
D<-rep(c(rep(-1,8),rep(1,8)),2)
E<-c(rep(-1,16),rep(1,16))
y<-c(8.11,5.56,5.77,5.82,9.17,7.8,3.23,5.69,8.82,14.23,9.2,8.94,8.68,11.49,6.25,9.12,7.93,5,7.47,12,9.86,3.65,6.4,11.61,12.43,17.55,8.87,25.38,13.08,18.85,11.78,26.05)
Dat5<-data.frame(A,B,C,D,E,y)
Dat5

Dat.Model6.39<-lm(y~A*B*C*D*E,data=Dat5)
coef(Dat.Model6.39)
halfnormal(Dat.Model6.39)

A<-as.fixed(A)
B<-as.fixed(B)
D<-as.fixed(D)
E<-as.fixed(E)
Dat5b<-data.frame(A,B,D,E,y)
Dat.Model6.39b<-aov(y~A+B+D+E+A*B+B*E+D*E+A*D+A*E+A*B*E+A*D*E,data=Dat5b)
plot(Dat.Model6.39b)

Dat5c<-data.frame(A,B,D,E,y)
Dat.Model6.39c<-aov(y~A*B*D*E,data=Dat5c)
GAD::gad(Dat.Model6.39c)

Dat.Model6.39d<-lm(y~A+B+D+E,data=Dat5)
coef(Dat.Model6.39d)