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(A,B,C,D,yield)
library(DoE.base)
## Warning: package 'DoE.base' was built under R version 4.5.2
## Loading required package: grid
## Loading required package: conf.design
## Warning: package 'conf.design' was built under R version 4.5.2
## 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
model <- lm(yield ~ A*B*C*D, data = dat)
halfnormal(model)
##
## Significant effects (alpha=0.05, Lenth method):
## [1] A A:C A:D D
The half-normal plot shows that the effects A, A:C, and A:D fall farthest from the reference line, indicating they are the most significant contributors to yield. All other effects cluster near the line, suggesting they are negligible
model2 <- aov(yield~A+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 ***
## D 1 42.25 42.25 26.000 0.000465 ***
## C 1 16.00 16.00 9.846 0.010549 *
## 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 this ANOVA analysis we can see that A, C, D, and their interactions with A all significantly influence the yield.