yield <- c(12,18,13,16,17,15,20,15,10,25,13,24,19,21,17,23)
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)
dat <- data.frame(yield,A,B,C,D)
#install.packages("DoE.base")
library(DoE.base)
## Warning: package 'DoE.base' was built under R version 4.1.3
## 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
model1<- lm(yield ~ A*B*C*D,data = dat)
halfnormal(model1)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] A A:C A:D D
abline(a= 0, b=1)
From the halfnormal plot it appears that factors A&D are significant along with interactions AC and AD
The multifactor ANOVA is compiled below
model2 <- aov(yield~ A+C+D+A*C+A*D, data= dat)
summary(model2)
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 81.00 81.00 49.846 3.46e-05 ***
## C 1 16.00 16.00 9.846 0.010549 *
## D 1 42.25 42.25 26.000 0.000465 ***
## A:C 1 72.25 72.25 44.462 5.58e-05 ***
## A:D 1 64.00 64.00 39.385 9.19e-05 ***
## Residuals 10 16.25 1.62
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From the results of the multifactor anova all the tested effects (A,D,AC,AD) are significant at \(\alpha =.05\)