7.12

obs <- c(10,0,4,0,0,5,6.5,16.5,4.5,19.5,15,41.5,8,21.5,0,18,18,16.5,6,10,0,20.5,18.5,4.5,18,18,16,39,4.5,10.5,0,5,14,4.5,1,34,18.5,18,7.5,0,14.5,16,8.5,6.5,6.5,6.5,0,7,12.5,17.5,14.5,11,19.5,20,6,23.5,10,5.5,0,3.5,10,0,4.5,10,19,20.5,12,25.5,16,29.5,0,8,0,10,0.5,7,13,15.5,1,32.5,16,17.5,14,21.5,15,19,10,8,17.5,7,9,8.5,41,24,4,18.5,18.5,33,5,0,11,10,0,8,6,36,3,36,14,16,6.5,8)
A <- c(-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1)
B <- c(rep(1,2),rep(-1,2),rep(1,2),rep(-1,2),rep(1,2),rep(-1,2),rep(1,2),rep(-1,2))
c <- c(rep(1,4),rep(-1,4),rep(1,4),rep(-1,4))
d <- c(rep(1,8),rep(-1,8))
block <- c(rep(1,16),rep(2,16),rep(3,16),rep(4,16),rep(5,16),rep(6,16),rep(7,16))
dat <- data.frame(A,B,c,d,block,obs)
lm_mod <- lm(obs~A*B*c*d+block,data = dat)
library(DoE.base)
## Warning: package 'DoE.base' was built under R version 4.2.2
## Loading required package: grid
## Loading required package: conf.design
## Registered S3 method overwritten by 'DoE.base':
##   method           from       
##   factorize.factor conf.design
## 
## Attaching package: 'DoE.base'
## The following objects are masked from 'package:stats':
## 
##     aov, lm
## The following object is masked from 'package:graphics':
## 
##     plot.design
## The following object is masked from 'package:base':
## 
##     lengths
halfnormal(lm_mod)
## Warning in halfnormal.lm(lm_mod): halfnormal not recommended for models with
## more residual df than model df
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A     lof5  block lof11 lof13

aov_mod <- aov(obs~A*B*c*d+block,data = dat)
summary(aov_mod)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## A            1    917   917.1  10.673 0.00151 **
## B            1    388   388.1   4.517 0.03616 * 
## c            1    145   145.1   1.689 0.19687   
## d            1      1     1.4   0.016 0.89888   
## block        1    152   152.1   1.769 0.18663   
## A:B          1    219   218.7   2.545 0.11398   
## A:c          1     12    11.9   0.138 0.71068   
## B:c          1    115   115.0   1.338 0.25020   
## A:d          1     94    93.8   1.092 0.29877   
## B:d          1     56    56.4   0.657 0.41976   
## c:d          1      2     1.6   0.019 0.89084   
## A:B:c        1      7     7.3   0.084 0.77206   
## A:B:d        1    113   113.0   1.315 0.25437   
## A:c:d        1     39    39.5   0.459 0.49952   
## B:c:d        1     34    33.8   0.393 0.53224   
## A:B:c:d      1     96    95.6   1.113 0.29411   
## Residuals   95   8164    85.9                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

7.20

7.21