Question A ( Display Half Normal Plot and Determine Factor appear Significant)

library(DoE.base)
## 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)
yield <- c(12,18,13,16,17,15,20,15,10,25,13,24,19,21,17,23)

dat <- data.frame(A,B,C,D,yield)
dat
##     A  B  C  D yield
## 1  -1 -1 -1 -1    12
## 2   1 -1 -1 -1    18
## 3  -1  1 -1 -1    13
## 4   1  1 -1 -1    16
## 5  -1 -1  1 -1    17
## 6   1 -1  1 -1    15
## 7  -1  1  1 -1    20
## 8   1  1  1 -1    15
## 9  -1 -1 -1  1    10
## 10  1 -1 -1  1    25
## 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(yield~A*B*C*D)
coef(mod)
##   (Intercept)             A             B             C             D 
##  1.737500e+01  2.250000e+00  2.500000e-01  1.000000e+00  1.625000e+00 
##           A:B           A:C           B:C           A:D           B:D 
## -3.750000e-01 -2.125000e+00  1.250000e-01  2.000000e+00 -6.595890e-16 
##           C:D         A:B:C         A:B:D         A:C:D         B:C:D 
## -2.984437e-16  5.000000e-01  3.750000e-01 -1.250000e-01 -3.750000e-01 
##       A:B:C:D 
##  5.000000e-01
halfnormal(mod)

## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A   A:C A:D D

From the Half normal plot, we can able to see clearly the significant factor A, D, AD, AC

Question - (B)

model_sig <- lm(yield~A+D+A:C+A:D, data=dat)

model_sig
## 
## Call:
## lm.default(formula = yield ~ A + D + A:C + A:D, data = dat)
## 
## Coefficients:
## (Intercept)            A            D          A:C          A:D  
##      17.375        2.250        1.625       -2.125        2.000
anova(model_sig)
## Analysis of Variance Table
## 
## Response: yield
##           Df Sum Sq Mean Sq F value    Pr(>F)    
## A          1  81.00  81.000  27.628 0.0002700 ***
## D          1  42.25  42.250  14.411 0.0029629 ** 
## A:C        1  72.25  72.250  24.643 0.0004259 ***
## A:D        1  64.00  64.000  21.829 0.0006801 ***
## Residuals 11  32.25   2.932                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

#As our significant level 0.05 Factor A, D, AC and AD this is confirm that all values are A, D, AC , AD < .05 so those are significant

library(DoE.base)

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)
yield <- c(12,18,13,16,17,15,20,15,10,25,13,24,19,21,17,23)

dat <- data.frame(A,B,C,D,yield)
dat

mod<- lm(yield~A*B*C*D)
coef(mod)
halfnormal(mod)



model_sig <- lm(yield~A+D+A:C+A:D, data=dat)

model_sig
anova(model_sig)