7.12

Hypothesis :

\(H_{0}\) : \(\tau\beta_{ij}\) = 0 \(\forall\) ij ,

\(H_{a}\) : \(\tau\beta_{ij}\) \(\neq\) 0 \(\exists\) ij .

library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
A <- rep(rep(c(-1,1),8),7)
B <- rep(rep(c(1,1,-1,-1),4),7)
C <- rep(rep(c(rep(1,4),rep(-1,4)),2),7) 
D <- rep(c(rep(1,8),rep(-1,8)),7)
obs7.12 <- c(10.0,0.0,4.0,0.0,0.0,5.0,6.5,16.5,4.5,19.5,15.0,41.5,8.0,21.5,0.0,18.0,18.0,16.5,6.0,10.0,0.0,20.5,18.5,4.5,18.0,18.0,16.0,39.0,4.5,10.5,0.0,5.0,14.0,4.5,1.0,34.0,18.5,18.0,7.5,0.0,14.5,16.0,8.5,6.5,6.5,6.5,0.0,7.0,12.5,17.5,14.5,11.0,19.5,20.0,6.0,23.5,10.0,5.5,0.0,3.5,10.0,0.0,4.5,10.0,19.0,20.5,12.0,25.5,16.0,29.5,0.0,8.0,0.0,10.0,0.5,7.0,13.0,15.5,1.0,32.5,16.0,17.5,14.0,21.5,15.0,19.0,10.0,8.0,17.5,7.0,9.0,8.5,41.0,24.0,4.0,18.5,18.5,33.0,5.0,0.0,11.0,10.0,0.0,8.0,6.0,36.0,3.0,36.0,14.0,16.0,6.5,8.0)

Performing anova :

dat7.12 <- data.frame(A,B,C,D,obs7.12)
model7.12 <- aov(obs7.12 ~ A*B*C*D, data = dat7.12)
summary(model7.12)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## A            1    917   917.1  10.588 0.00157 **
## B            1    388   388.1   4.481 0.03686 * 
## C            1    145   145.1   1.676 0.19862   
## D            1      1     1.4   0.016 0.89928   
## A:B          1    219   218.7   2.525 0.11538   
## A:C          1     12    11.9   0.137 0.71178   
## B:C          1    115   115.0   1.328 0.25205   
## A:D          1     94    93.8   1.083 0.30066   
## B:D          1     56    56.4   0.651 0.42159   
## C:D          1      2     1.6   0.019 0.89127   
## A:B:C        1      7     7.3   0.084 0.77294   
## A:B:D        1    113   113.0   1.305 0.25623   
## A:C:D        1     39    39.5   0.456 0.50121   
## B:C:D        1     34    33.8   0.390 0.53386   
## A:B:C:D      1     96    95.6   1.104 0.29599   
## Residuals   96   8316    86.6                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Interaction plot between factors

interaction.plot(A,B,obs7.12)

interaction.plot(A,C,obs7.12)

interaction.plot(A,D,obs7.12)

interaction.plot(B,C,obs7.12)

interaction.plot(B,D,obs7.12)

interaction.plot(C,D,obs7.12)

Manipulating data :

block <- as.fixed(rep(seq(1,7),16))
A <- as.fixed(A)
B <- as.fixed(B)
C <- as.fixed(C)
D <- as.fixed(D)
model7.12 <- lm(obs7.12 ~ block + A*B*C*D)
gad(model7.12)
## Analysis of Variance Table
## 
## Response: obs7.12
##          Df Sum Sq Mean Sq F value   Pr(>F)   
## block     6  397.2   66.21  0.7525 0.609049   
## A         1  917.1  917.15 10.4240 0.001736 **
## B         1  388.1  388.15  4.4116 0.038494 * 
## C         1  145.1  145.15  1.6497 0.202299   
## D         1    1.4    1.40  0.0159 0.900075   
## A:B       1  218.7  218.68  2.4855 0.118411   
## A:C       1   11.9   11.90  0.1352 0.713967   
## B:C       1  115.0  115.02  1.3073 0.255919   
## A:D       1   93.8   93.81  1.0662 0.304579   
## B:D       1   56.4   56.43  0.6414 0.425322   
## C:D       1    1.6    1.63  0.0185 0.892129   
## A:B:C     1    7.3    7.25  0.0824 0.774695   
## A:B:D     1  113.0  113.00  1.2844 0.260101   
## A:C:D     1   39.5   39.48  0.4488 0.504635   
## B:C:D     1   33.8   33.77  0.3838 0.537130   
## A:B:C:D   1   95.6   95.65  1.0871 0.299912   
## Residual 90 7918.5   87.98                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Interaction plots between factors after blocking

interaction.plot(A,B,obs7.12)

interaction.plot(A,C,obs7.12)

interaction.plot(A,D,obs7.12)

interaction.plot(B,C,obs7.12)

interaction.plot(B,D,obs7.12)

interaction.plot(C,D,obs7.12)

The p-values of the main effects and interactions do not significantly change before and after blocking. The blocking does not affect the interactions observed from the interaction plots before and after blocking.

7.20

Selecting ABCE and ABDF effects also confounds CDEF.

ABCE * ABDF = A^2B^2 CDEF

Below is self manual randomly generated design

B1 <- c("A","B","CD","ABCD","ACE","BCE","DE","ABDE","CF","ABCF","ADF","BDF","EF","ABEF","ACDEF","BCDEF")
B2 <- c("C","ABC","AD","BD","E","ABE","ACDE","BCDE","AF","BF","CDF","ABCDF","ACEF","BCEF","DEF","ABDEF")
B3 <- c("AC","BC","D","ABD","AE","BE","CDE","ABCDE","F","ABF","ACDF","BCDF","CEF","ABCEF","ADEF","BDEF")
B4 <- c("(1)","AB","ACD","BCD","CE","ABCE","ADE","BDE","ACF","BCF","DF","ABDF","AEF","BEF","CDEF","ABCDEF")
design <- cbind(B1,B2,B3,B4)
design
##       B1      B2      B3      B4      
##  [1,] "A"     "C"     "AC"    "(1)"   
##  [2,] "B"     "ABC"   "BC"    "AB"    
##  [3,] "CD"    "AD"    "D"     "ACD"   
##  [4,] "ABCD"  "BD"    "ABD"   "BCD"   
##  [5,] "ACE"   "E"     "AE"    "CE"    
##  [6,] "BCE"   "ABE"   "BE"    "ABCE"  
##  [7,] "DE"    "ACDE"  "CDE"   "ADE"   
##  [8,] "ABDE"  "BCDE"  "ABCDE" "BDE"   
##  [9,] "CF"    "AF"    "F"     "ACF"   
## [10,] "ABCF"  "BF"    "ABF"   "BCF"   
## [11,] "ADF"   "CDF"   "ACDF"  "DF"    
## [12,] "BDF"   "ABCDF" "BCDF"  "ABDF"  
## [13,] "EF"    "ACEF"  "CEF"   "AEF"   
## [14,] "ABEF"  "BCEF"  "ABCEF" "BEF"   
## [15,] "ACDEF" "DEF"   "ADEF"  "CDEF"  
## [16,] "BCDEF" "ABDEF" "BDEF"  "ABCDEF"

7.21

In addition to the three confounded effects in the problem statement, four other effects are confounded with the design (BDE, CDEF, BCF, and ADF). This is a self generated random design.

Bl4 <- c("B","ACD","CE","ABDE","ABCF","DE","AEF","BCDEF")
Bl2 <- c("ABC","D","AE","BCDE","BF","ACDF","CEF","ABDEF")
Bl3 <- c("A","BCD","ABCE","DE","CF","ABDF","DEF","ACDEF")
Bl1 <- c("C","ABD","BE","ACDE","AF","BCDF","ABCEF","DEF")
Bl5 <- c("AC","BD","ABE","CDE","F","ABCDF","BCEF","ADEF")
Bl6 <- c("(1)","ABCD","BCE","ADE","ACF","BDF","ABEF","CDEF")
Bl7 <- c("BC","AD","E","ABCDE","ABF","CDF","ACEF","BDEF")
Bl8 <- c("AB","CD","ACE","BDE","BCF","ADF","EF","ABCDEF")
design7.21 <- cbind(Bl1,Bl2,Bl3,Bl4,Bl5,Bl6,Bl7,Bl8)
design7.21
##      Bl1     Bl2     Bl3     Bl4     Bl5     Bl6    Bl7     Bl8     
## [1,] "C"     "ABC"   "A"     "B"     "AC"    "(1)"  "BC"    "AB"    
## [2,] "ABD"   "D"     "BCD"   "ACD"   "BD"    "ABCD" "AD"    "CD"    
## [3,] "BE"    "AE"    "ABCE"  "CE"    "ABE"   "BCE"  "E"     "ACE"   
## [4,] "ACDE"  "BCDE"  "DE"    "ABDE"  "CDE"   "ADE"  "ABCDE" "BDE"   
## [5,] "AF"    "BF"    "CF"    "ABCF"  "F"     "ACF"  "ABF"   "BCF"   
## [6,] "BCDF"  "ACDF"  "ABDF"  "DE"    "ABCDF" "BDF"  "CDF"   "ADF"   
## [7,] "ABCEF" "CEF"   "DEF"   "AEF"   "BCEF"  "ABEF" "ACEF"  "EF"    
## [8,] "DEF"   "ABDEF" "ACDEF" "BCDEF" "ADEF"  "CDEF" "BDEF"  "ABCDEF"