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)
model<-lm(yield~A*B*C*D, data = dat )
#install.packages("DoE.base")
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
halfnormal(model)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] A A:C A:D D
From the above displayed halfnormal plot, the factors that appears to be significant are A, D, AD, AC.
model3<- aov(yield~B+C+A*B+B*C+B*D+C*D+A*B*C+A*B*D+A*C*D+B*C*D, data=dat)
summary(model3)
## Df Sum Sq Mean Sq F value Pr(>F)
## B 1 1.00 1.00 0.250 0.705
## C 1 16.00 16.00 4.000 0.295
## A 1 81.00 81.00 20.250 0.139
## D 1 42.25 42.25 10.562 0.190
## B:A 1 2.25 2.25 0.562 0.590
## B:C 1 0.25 0.25 0.063 0.844
## B:D 1 0.00 0.00 0.000 1.000
## C:D 1 0.00 0.00 0.000 1.000
## C:A 1 72.25 72.25 18.062 0.147
## A:D 1 64.00 64.00 16.000 0.156
## B:C:A 1 4.00 4.00 1.000 0.500
## B:A:D 1 2.25 2.25 0.562 0.590
## C:A:D 1 0.25 0.25 0.063 0.844
## B:C:D 1 2.25 2.25 0.562 0.590
## Residuals 1 4.00 4.00
After pulling the terms that do not appear to be significant , we can observe that the terms seems to be significant are the one we got through the halfnormal plot i.e. A, D, AC, AD with p values 0.139, 0.190, 0.147, 0.156 respectively.