Q11

A)

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
A<-c(-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1)
B<-c(-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1)
C<-c(-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1)
D<-c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1)
obs<-c(12,18,13,20,17,25,15,25,10,24,13,24,19,21,17,23)
dat<-data.frame(A,B,C,D,obs)
dat
##     A  B  C  D obs
## 1  -1 -1 -1 -1  12
## 2   1 -1 -1 -1  18
## 3  -1  1 -1 -1  13
## 4   1  1 -1 -1  20
## 5  -1 -1  1 -1  17
## 6   1 -1  1 -1  25
## 7  -1  1  1 -1  15
## 8   1  1  1 -1  25
## 9  -1 -1 -1  1  10
## 10  1 -1 -1  1  24
## 11 -1  1 -1  1  13
## 12  1  1 -1  1  24
## 13 -1 -1  1  1  19
## 14  1 -1  1  1  21
## 15 -1  1  1  1  17
## 16  1  1  1  1  23
mod<-lm(obs~A*B*C*D,data=dat)
halfnormal(mod)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A     C     A:C:D

From the halfnormal plot we can see that Factor A, C and the interaction between A:C:D are significants.

B)

\[ H_0: \mu_a=\mu_b=\mu_c=\mu_d \] \[ Ha: at \; least\; one\; mean \; is \; different \]

model<-aov(obs~A+C+D+A*C*D)
summary(model)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## A            1 256.00  256.00 157.538 1.52e-06 ***
## C            1  49.00   49.00  30.154  0.00058 ***
## D            1   2.25    2.25   1.385  0.27314    
## A:C          1   9.00    9.00   5.538  0.04643 *  
## A:D          1   0.25    0.25   0.154  0.70513    
## C:D          1   6.25    6.25   3.846  0.08550 .  
## A:C:D        1  30.25   30.25  18.615  0.00256 ** 
## Residuals    8  13.00    1.63                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Performing the ANOVA only with the significant factors, we can see that Factors A, C and the interactions beteen A:C and A:C:D are significant with an alpha of 0.05, confirming the previous halfnormal plot. However, the halfnormal plot did not pointed out the interaction A:C, since is very close to 0.05. Therefore, we can reject the null hypothesis.