This report captures work done for the individual homework for Week 11. R code along with the results are provided. The required homework problems were taken from “Design and Analysis of Experiments 8th Edition”:
   1) 7.12
   2) 7.20
   3) 7.21


Setting Things Up

# setup Libraries
library(knitr)
library(dplyr)
library(tidyr)
library(GAD)
library(tinytex)
library(ggplot2)
library(ggfortify)
library(car)
library(DoE.base)
# READ IN FILE
setwd("D:/R Files/")
dat3 <- read.csv("D:/R Files/6-21.csv",header=TRUE)

Problem 1 (7.12 - 6.21 with blocking)

Consider the potting experiment in Problem 6.21. Analyze the data considering each replicate as a block.

Block <-dat3$Block
PuttLength <- dat3$PuttLength
PutterType <- dat3$PutterType
PuttBreak <- dat3$PuttBreak
PuttSlope <- dat3$PuttSlope
DistanceFromCup <- dat3$DistanceFromCup
PuttLength <- as.fixed(PuttLength)
PutterType <- as.fixed(PutterType)
PuttBreak <-  as.fixed(PuttBreak)
PuttSlope <-  as.fixed(PuttSlope)
Block <- as.fixed(Block)
mod3 <- lm(DistanceFromCup~PuttLength+PutterType+PuttBreak+PuttSlope+Block+
              PuttLength*PutterType+
              PuttLength*PuttBreak+
              PutterType*PuttBreak+
              PuttLength*PuttSlope+
              PutterType*PuttSlope+
              PuttBreak*PuttSlope+
              PuttLength*PutterType*PuttBreak+
              PuttLength*PutterType*PuttSlope+
              PuttLength*PuttBreak*PuttSlope+
              PuttLength*PuttBreak*PuttSlope+
              PutterType*PuttBreak*PuttSlope+
              PuttLength*PutterType*PuttBreak*PuttSlope)
GAD::gad(mod3)
## Analysis of Variance Table
## 
## Response: DistanceFromCup
##                                           Df Sum Sq Mean Sq F value  Pr(>F)   
## PuttLength                                 1  917.1  917.15 10.3962 0.00176 **
## PutterType                                 1  388.1  388.15  4.3998 0.03875 * 
## PuttBreak                                  1  145.1  145.15  1.6453 0.20290   
## PuttSlope                                  1    1.4    1.40  0.0158 0.90021   
## Block                                      6  376.1   62.68  0.7105 0.64202   
## PuttLength:PutterType                      1  218.7  218.68  2.4788 0.11890   
## PuttLength:PuttBreak                       1   11.9   11.90  0.1348 0.71433   
## PutterType:PuttBreak                       1  115.0  115.02  1.3038 0.25655   
## PuttLength:PuttSlope                       1   93.8   93.81  1.0633 0.30522   
## PutterType:PuttSlope                       1   56.4   56.43  0.6397 0.42594   
## PuttBreak:PuttSlope                        1    1.6    1.63  0.0184 0.89227   
## PuttLength:PutterType:PuttBreak            1    7.3    7.25  0.0822 0.77499   
## PuttLength:PutterType:PuttSlope            1  113.0  113.00  1.2809 0.26073   
## PuttLength:PuttBreak:PuttSlope             1   39.5   39.48  0.4476 0.50520   
## PutterType:PuttBreak:PuttSlope             1   33.8   33.77  0.3828 0.53767   
## PuttLength:PutterType:PuttBreak:PuttSlope  1   95.6   95.65  1.0842 0.30055   
## Residual                                  90 7939.7   88.22                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


I’ll remove the 4th level interaction effect and run again because it isn’t significant to an alpha of 0.05.

mod31 <- lm(DistanceFromCup~PuttLength+PutterType+PuttBreak+PuttSlope+Block+
              PuttLength*PutterType+
              PuttLength*PuttBreak+
              PutterType*PuttBreak+
              PuttLength*PuttSlope+
              PutterType*PuttSlope+
              PuttBreak*PuttSlope+
              PuttLength*PutterType*PuttBreak+
              PuttLength*PutterType*PuttSlope+
              PuttLength*PuttBreak*PuttSlope+
              PuttLength*PuttBreak*PuttSlope+
              PutterType*PuttBreak*PuttSlope)
GAD::gad(mod31)
## Analysis of Variance Table
## 
## Response: DistanceFromCup
##                                 Df Sum Sq Mean Sq F value   Pr(>F)   
## PuttLength                       1  917.1  917.15 10.3866 0.001762 **
## PutterType                       1  388.1  388.15  4.3957 0.038804 * 
## PuttBreak                        1  145.1  145.15  1.6438 0.203067   
## PuttSlope                        1    1.4    1.40  0.0158 0.900250   
## Block                            6  376.1   62.68  0.7098 0.642528   
## PuttLength:PutterType            1  218.7  218.68  2.4765 0.119026   
## PuttLength:PuttBreak             1   11.9   11.90  0.1347 0.714449   
## PutterType:PuttBreak             1  115.0  115.02  1.3026 0.256734   
## PuttLength:PuttSlope             1   93.8   93.81  1.0623 0.305413   
## PutterType:PuttSlope             1   56.4   56.43  0.6391 0.426128   
## PuttBreak:PuttSlope              1    1.6    1.63  0.0184 0.892318   
## PuttLength:PutterType:PuttBreak  1    7.3    7.25  0.0821 0.775082   
## PuttLength:PutterType:PuttSlope  1  113.0  113.00  1.2797 0.260920   
## PuttLength:PuttBreak:PuttSlope   1   39.5   39.48  0.4472 0.505381   
## PutterType:PuttBreak:PuttSlope   1   33.8   33.77  0.3824 0.537843   
## Residual                        91 8035.4   88.30                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

We can now see that none of the 3rd level interaction effects are close to being significant so we will remove them and re-run the model.

mod32 <- lm(DistanceFromCup~PuttLength+PutterType+PuttBreak+PuttSlope+Block+
              PuttLength*PutterType+
              PuttLength*PuttBreak+
              PutterType*PuttBreak+
              PuttLength*PuttSlope+
              PutterType*PuttSlope+
              PuttBreak*PuttSlope)
GAD::gad(mod32)
## Analysis of Variance Table
## 
## Response: DistanceFromCup
##                       Df Sum Sq Mean Sq F value   Pr(>F)   
## PuttLength             1  917.1  917.15 10.5882 0.001577 **
## PutterType             1  388.1  388.15  4.4810 0.036886 * 
## PuttBreak              1  145.1  145.15  1.6757 0.198640   
## PuttSlope              1    1.4    1.40  0.0161 0.899281   
## Block                  6  376.1   62.68  0.7236 0.631626   
## PuttLength:PutterType  1  218.7  218.68  2.5246 0.115406   
## PuttLength:PuttBreak   1   11.9   11.90  0.1373 0.711780   
## PutterType:PuttBreak   1  115.0  115.02  1.3279 0.252075   
## PuttLength:PuttSlope   1   93.8   93.81  1.0830 0.300678   
## PutterType:PuttSlope   1   56.4   56.43  0.6515 0.421601   
## PuttBreak:PuttSlope    1    1.6    1.63  0.0188 0.891272   
## Residual              95 8228.9   86.62                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

We then remove each secondary interaction in order of highest p-value and discover that as we remove each term, none of the 2nd order interactions are significant. The step-wise process hasn’t been shown here for brevity. Running the model with main effects, we get the following:

mod33 <- lm(DistanceFromCup~PuttLength+PutterType+PuttBreak+PuttSlope+Block)
GAD::gad(mod33)
## Analysis of Variance Table
## 
## Response: DistanceFromCup
##             Df Sum Sq Mean Sq F value   Pr(>F)   
## PuttLength   1  917.1  917.15 10.6152 0.001528 **
## PutterType   1  388.1  388.15  4.4925 0.036496 * 
## PuttBreak    1  145.1  145.15  1.6799 0.197888   
## PuttSlope    1    1.4    1.40  0.0161 0.899137   
## Block        6  376.1   62.68  0.7254 0.630108   
## Residual   101 8726.3   86.40                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


We now remove Block because it isn’t significant and re-run:

mod33 <- lm(DistanceFromCup~PuttLength+PutterType+PuttBreak+PuttSlope)
GAD::gad(mod33)
## Analysis of Variance Table
## 
## Response: DistanceFromCup
##             Df Sum Sq Mean Sq F value   Pr(>F)   
## PuttLength   1  917.1  917.15 10.7812 0.001386 **
## PutterType   1  388.1  388.15  4.5627 0.034956 * 
## PuttBreak    1  145.1  145.15  1.7062 0.194280   
## PuttSlope    1    1.4    1.40  0.0164 0.898342   
## Residual   107 9102.4   85.07                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


We now remove PuttSlope becasue it isn’t significant and re-run:

mod34 <- lm(DistanceFromCup~PuttLength+PutterType+PuttBreak)
GAD::gad(mod34)
## Analysis of Variance Table
## 
## Response: DistanceFromCup
##             Df Sum Sq Mean Sq F value   Pr(>F)   
## PuttLength   1  917.1  917.15 10.8803 0.001317 **
## PutterType   1  388.1  388.15  4.6046 0.034125 * 
## PuttBreak    1  145.1  145.15  1.7219 0.192233   
## Residual   108 9103.8   84.29                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


We now remove PuttBreak becasue it isn’t significant and re-run:

mod35 <- lm(DistanceFromCup~PuttLength+PutterType)
GAD::gad(mod35)
## Analysis of Variance Table
## 
## Response: DistanceFromCup
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## PuttLength   1  917.1  917.15 10.8087 0.00136 **
## PutterType   1  388.1  388.15  4.5743 0.03469 * 
## Residual   109 9248.9   84.85                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

And we now find the significant factors, we see PuttLength at a p-value of 0.00136 and PutterType at a p-value of 0.03469.
b) Analyze the residuals from this experiment. Are there any indications of model inadequacy?
The resiudal plots are below:

autoplot(mod35)


The residuals appear to be significantly not normal at the higher end of the theoretical quantiles so the model is inadequate.

Problem 2 (7.20)

Design an experiment for confounding a 2^6 factorial in four blocks. Suggest an appropriate confounding scheme, different from the one shown in Table 7.8

My design will have the following independent effects chosen to be confounded with blocks:
1 = ABC
2 = DEF
Which then can be multipled together for the remaining term:
3 = ABCDEF

This results in the following experimental plan:

dat4 <- read.csv("D:/R Files/7-20.csv",header=TRUE)
kable(dat4)
Run Block A B C D E F
1 1 - - - - - -
2 1 + + - - - -
3 1 + - + - - -
4 1 - + + - - -
5 1 - - - + + -
6 1 + + - + + -
7 1 + - + + + -
8 1 - + + + + -
9 1 - - - + - +
10 1 + + - + - +
11 1 + - + + - +
12 1 - + + + - +
13 1 - - - - + +
14 1 + + - - + +
15 1 + - + - + +
16 1 - + + - + +
17 2 + - - - - -
18 2 - + - - - -
19 2 - - + - - -
20 2 + + + - - -
21 2 + - - + + -
22 2 - + - + + -
23 2 - - + + + -
24 2 + + + + + -
25 2 + - - + - +
26 2 - + - + - +
27 2 - - + + - +
28 2 + + + + - +
29 2 + - - - + +
30 2 - + - - + +
31 2 - - + - + +
32 2 + + + - + +
33 3 - - - + - -
34 3 + + - + - -
35 3 + - + + - -
36 3 - + + + - -
37 3 - - - - + -
38 3 + + - - + -
39 3 + - + - + -
40 3 - + + - + -
41 3 - - - - - +
42 3 + + - - - +
43 3 + - + - - +
44 3 - + + - - +
45 3 - - - + + +
46 3 + + - + + +
47 3 + - + + + +
48 3 - + + + + +
49 4 + - - + - -
50 4 - + - + - -
51 4 - - + + - -
52 4 + + + + - -
53 4 + - - - + -
54 4 - + - - + -
55 4 - - + - + -
56 4 + + + - + -
57 4 + - - - - +
58 4 - + - - - +
59 4 - - + - - +
60 4 + + + - - +
61 4 + - - + + +
62 4 - + - + + +
63 4 - - + + + +
64 4 + + + + + +

Problem 3 (7.21)

Consider the 2^6 design in eight blocks of eight runs each with ABCD, ACE, and ABEF as the independent effects chosen to be confounded with blocks. Generate the design. Find the other effects confounded with blocks.

The independent effects chosen to be confounded with blocks:
1 = ABCD (given)
2 = ACE (given)
3 = ABEF (given)

Which then can be multiplied for the remaining terms:
4 = ABCD * ACE = A^2 * B * C^2 * D * E = BDE
5 = ACE * ABEF = A^2 * B * C * E^2 * F = BCF
6 = ABCD * ABEF = A^2 * B^2 * C * D * E * F = CDEF
7 = ABCD * ACE * ABEF = A^3 * B^2 * C^2 * D * E^2 * F = ADF

This generates the following design:

dat5 <- read.csv("D:/R Files/7-21.csv",header=TRUE)
kable(dat5)
Run Block A B C D E F
1 1 - + - - - -
2 1 + - + + - -
3 1 - - + - + -
4 1 + + - + + -
5 1 + + + - - +
6 1 - - - + - +
7 1 + - - - + +
8 1 - + + + + +
9 2 + - + - - -
10 2 - + - + - -
11 2 + + - - + -
12 2 - - + + + -
13 2 - - - - - +
14 2 + + + + - +
15 2 - + + - + +
16 2 + - - + + +
17 3 + - - - - -
18 3 - + + + - -
19 3 + + + - + -
20 3 - - - + + -
21 3 - - + - - +
22 3 + + - + - +
23 3 - + - - + +
24 3 + - + + + +
25 4 - + + - - -
26 4 + - - + - -
27 4 - - - - + -
28 4 + + + + + -
29 4 + + - - - +
30 4 - - + + - +
31 4 + - + - + +
32 4 - + - + + +
33 5 + + + - - -
34 5 - - - + - -
35 5 + - - - + -
36 5 - + + + + -
37 5 - + - - - +
38 5 + - + + - +
39 5 - - + - + +
40 5 + + - + + +
41 6 - - - - - -
42 6 + + + + - -
43 6 - + + - + -
44 6 + - - + + -
45 6 + - + - - +
46 6 - + - + - +
47 6 + + - - + +
48 6 - - + + + +
49 7 - - + - - -
50 7 + + - + - -
51 7 - + - - + -
52 7 + - + + + -
53 7 + - - - - +
54 7 - + + + - +
55 7 + + + - + +
56 7 - - - + + +
57 8 + + - - - -
58 8 - - + + - -
59 8 + - + - + -
60 8 - + - + + -
61 8 - + + - - +
62 8 + - - + - +
63 8 - - - - + +
64 8 + + + + + +