Getting in data
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,20,17,25,15,25,10,24,13,24,19,21,17,23)
dat<-data.frame(A,B,C,D,yield)
Question a
library(DoE.base)
model<-lm(yield~A*B*C*D,data=dat)
coef(model)
## (Intercept) A B C D A:B
## 18.500 4.000 0.250 1.750 0.375 0.250
## A:C B:C A:D B:D C:D A:B:C
## -0.750 -0.500 0.125 0.125 -0.625 0.500
## A:B:D A:C:D B:C:D A:B:C:D
## -0.125 -1.375 0.125 0.375
halfnormal(model)
From the half normal plot we can see that
factor A, Factor C and interaction factor A:C:D appears to be significant
Question b
Question 2
Stating hypothesis
WE would test the highest order term first
alpha(i) beta(j) gamma(k) = 0
alpha(i) beta(j) gamma(k) is not equals to zero
model2<-lm(yield~A+C+D+A+C+A+D+C+D+A*C*D,data=dat)
summary(model2)
##
## Call:
## lm.default(formula = yield ~ A + C + D + A + C + A + D + C +
## D + A * C * D, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.5 -1.0 0.0 1.0 1.5
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 18.5000 0.3187 58.050 8.61e-12 ***
## A 4.0000 0.3187 12.551 1.52e-06 ***
## C 1.7500 0.3187 5.491 0.00058 ***
## D 0.3750 0.3187 1.177 0.27314
## A:C -0.7500 0.3187 -2.353 0.04643 *
## A:D 0.1250 0.3187 0.392 0.70513
## C:D -0.6250 0.3187 -1.961 0.08550 .
## A:C:D -1.3750 0.3187 -4.315 0.00256 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.275 on 8 degrees of freedom
## Multiple R-squared: 0.9645, Adjusted R-squared: 0.9334
## F-statistic: 31.03 on 7 and 8 DF, p-value: 3.475e-05
Since the higher order interaction factors is significant A:C:D(0.00256) at alpha is 0.05
We could stop our hypothesis here