Problem 6.8

\(H_{0}\): (\(\tau \beta_{ij}\)) = 0
\(H_{1}\): At least one (\(\tau \beta_{ij}\)) \(\neq\) 0
library(DoE.base)
## Warning: package 'DoE.base' was built under R version 4.0.5
## Loading required package: grid
## Loading required package: conf.design
## Warning: package 'conf.design' was built under R version 4.0.3
## 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
c1 <- c(21,23,20,37,38,35)
c2 <- c(22,28,26,39,38,36)
c3 <- c(25,24,29,31,29,30)
c4 <- c(26,25,27,34,33,35)
response <- c(c1,c2,c3,c4)
culture <- c(rep(-1,12),rep(1,12))
time <- rep(c(rep(-1,3),rep(1,3)),4)
dat <- as.data.frame(cbind(response,culture,time))
model <- lm(response~culture*time,data=dat)
halfnormal(model)
## Warning in halfnormal.lm(model): halfnormal not recommended for models with more
## residual df than model df
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] time         culture:time

interaction.plot(culture,time,response)

model <- aov(response~culture*time,data=dat)
summary(model)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## culture       1    9.4     9.4   1.835 0.190617    
## time          1  590.0   590.0 115.506 9.29e-10 ***
## culture:time  1   92.0    92.0  18.018 0.000397 ***
## Residuals    20  102.2     5.1                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model)

## hat values (leverages) are all = 0.1666667
##  and there are no factor predictors; no plot no. 5

The residuals plot does not show anything unusual, so the model is adequate.

Problem 6.12

\(H_{0}\): (\(\tau \beta_{ij}\)) = 0
\(H_{1}\): At least one (\(\tau \beta_{ij}\)) \(\neq\) 0
A <- c(-1,1,-1,1)
B <- c(-1,-1,1,1)
AB <- A*B
Factor <- cbind(A,B,AB)
Factor
##       A  B AB
## [1,] -1 -1  1
## [2,]  1 -1 -1
## [3,] -1  1 -1
## [4,]  1  1  1
I <- c(14.037,13.880,14.821,14.888)
II <- c(16.165,13.860,14.757,14.921)
III <- c(13.972,14.032,14.843,14.415)
IV <- c(13.907,13.914,14.878,14.932)
response <- cbind(I,II,III,IV)
mean(c(I,II,III,IV))
## [1] 14.51388
dat <- as.data.frame(cbind(A,B,AB,response))
dat$total <- c(sum(dat[1,4:7]),sum(dat[2,4:7]),sum(dat[3,4:7]),sum(dat[4,4:7]))
effect_A <- (-dat[1,8]-dat[3,8])+(dat[2,8]+dat[4,8]) # effect of factor A
effect_B <- (-dat[1,8]-dat[2,8])+(dat[3,8]+dat[4,8]) # effect of factor B
effect_AB <- dat[1,8]+dat[4,8]-dat[2,8]-dat[3,8] # effect of factor interaction AB
dat
##    A  B AB      I     II    III     IV  total
## 1 -1 -1  1 14.037 16.165 13.972 13.907 58.081
## 2  1 -1 -1 13.880 13.860 14.032 13.914 55.686
## 3 -1  1 -1 14.821 14.757 14.843 14.878 59.299
## 4  1  1  1 14.888 14.921 14.415 14.932 59.156
effect_A
## [1] -2.538
effect_B
## [1] 4.688
effect_AB
## [1] 2.252
A <- rep(A,4)
B <- rep(B,4)
response <- c(I,II,III,IV)
dat <- as.data.frame(cbind(A,B,response))
model <- aov(response~A+B+A*B,data=dat)
summary(model)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## A            1  0.403  0.4026   1.262 0.2833  
## B            1  1.374  1.3736   4.305 0.0602 .
## A:B          1  0.317  0.3170   0.994 0.3386  
## Residuals   12  3.828  0.3190                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model)

## hat values (leverages) are all = 0.25
##  and there are no factor predictors; no plot no. 5

model <- lm(response~A+B+A*B,data=dat)
halfnormal(model)
## Warning in halfnormal.lm(model): halfnormal not recommended for models with more
## residual df than model df
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] e7 B  A

interaction.plot(A,B,response)

y1 <- 14.51388-2.538-4.688
y2 <- 14.51388+2.538-4.688 # residuals calculations
y3 <- 14.51388-2.538+4.688
y4 <- 14.51388+2.538+4.688

e1 <- I[1]-y1
e2 <- II[1]-y1
e3 <- III[1]-y1 # Residuals calculations
e4 <- IV[1]-y1
e5 <- I[2]-y2
e6 <- II[2]-y2
e7 <- III[2]-y2
e8 <- IV[2]-y2
e9 <- I[3]-y3
e10 <- II[3]-y3
e11 <- III[3]-y3
e12 <- IV[3]-y3
e13 <- I[4]-y4
e14 <- II[4]-y4
e15 <- III[4]-y4
e16 <- IV[4]-y4
residuals <- c(e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16)
residuals
##  [1]  6.74912  8.87712  6.68412  6.61912  1.51612  1.49612  1.66812  1.55012
##  [9] -1.84288 -1.90688 -1.82088 -1.78588 -6.85188 -6.81888 -7.32488 -6.80788
(a) The effects are -2.538, 4.688, and 2.252 for factors A, B, and interaction AB, respectively.
(b) From the ANOVA, the p-values of Factor A and Factor B are greater than 0.05, so both factors are not important. However, Factor B has a p-value only slightly larger than 0.05, so at a significance level 0.10, it would be important.
(c) Regression Model: \(\hat y\) = 14.51388-2.538\(x_{1}\)+4.688\(x_{2}\) This regression equation’s intercept corresponds to the grand mean of all the observations, and the regression coefficients correspond to one-half the factor estimates determined in part (a).
(d) One residual is much greater than the others, as can be seen in the residual plot
(e)

Problem 6.21

\(H_{0}\): (\(\tau \beta_{ij}\)) = 0
\(H_{1}\): At least one (\(\tau \beta_{ij}\)) \(\neq\) 0
A <- rep(rep(c(-1,1),8),7) # Factor A
B <- rep(rep(c(1,1,-1,-1),4),7) # Factor B
C <- rep(rep(c(rep(1,4),rep(-1,4)),2),7) # Factor C
D <- rep(c(rep(1,8),rep(-1,8)),7) # Factor D
I <- c(10.0,0.0,4.0,0.0,0.0,5.0,6.5,16.5,4.5,19.5,15.0,41.5,8.0,21.5,0.0,18.0)
II <- c(18.0,16.5,6.0,10.0,0.0,20.5,18.5,4.5,18.0,18.0,16.0,39.0,4.5,10.5,0.0,5.0)
III <- c(14.0,4.5,1.0,34.0,18.5,18.0,7.5,0.0,14.5,16.0,8.5,6.5,6.5,6.5,0.0,7.0)
IV <- c(12.5,17.5,14.5,11.0,19.5,20.0,6.0,23.5,10.0,5.5,0.0,3.5,10.0,0.0,4.5,10.0)
V <- c(19.0,20.5,12.0,25.5,16.0,29.5,0.0,8.0,0.0,10.0,0.5,7.0,13.0,15.5,1.0,32.5)
VI <- c(16.0,17.5,14.0,21.5,15.0,19.0,10.0,8.0,17.5,7.0,9.0,8.5,41.0,24.0,4.0,18.5)
VII <- c(18.5,33.0,5.0,0.0,11.0,10.0,0.0,8.0,6.0,36.0,3.0,36.0,14.0,16.0,6.5,8.0)
response <- c(I,II,III,IV,V,VI,VII)
dat <- as.data.frame(cbind(A,B,C,D,response))
model <- lm(response~A*B*C*D,data=dat)
halfnormal(model)
## Warning in halfnormal.lm(model): halfnormal not recommended for models with more
## residual df than model df
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A   e74 e92 B   e53

model <- aov(response~A*B,data=dat)
plot(model)

## hat values (leverages) are all = 0.03571429
##  and there are no factor predictors; no plot no. 5

(a) From the halfnormal plot, Factor A and Factor B are significant
(b) The residual plot does not show any model inadequacy

Problem 6.36

\(H_{0}\): (\(\tau \beta_{ij}\)) = 0
\(H_{1}\): At least one (\(\tau \beta_{ij}\)) \(\neq\) 0
a <- c(-1,1)
b <- c(-1,-1,1,1)
c <- c(-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)
A <- c(rep(a,8))
B <- c(rep(b,4))
C <- c(rep(c,2))
D <- c(rep(d,1))
response <- c(1.92,11.28,1.09,5.75,2.13,9.53,1.03,5.35,1.60,11.73,1.16,4.68,2.16,9.11,1.07,5.30)
dat <- as.data.frame(cbind(A,B,C,D,response))
model <- lm(response~A*B*C*D,data=dat)
halfnormal(model)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A     B     A:B   A:B:C

model <- aov(response~A*B*C,data=dat)
summary(model)
##             Df Sum Sq Mean Sq  F value   Pr(>F)    
## A            1 159.83  159.83 1563.061 1.84e-10 ***
## B            1  36.09   36.09  352.937 6.66e-08 ***
## C            1   0.78    0.78    7.616  0.02468 *  
## A:B          1  18.30   18.30  178.933 9.33e-07 ***
## A:C          1   1.42    1.42   13.907  0.00579 ** 
## B:C          1   0.84    0.84    8.232  0.02085 *  
## A:B:C        1   1.90    1.90   18.556  0.00259 ** 
## Residuals    8   0.82    0.10                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model)

## hat values (leverages) are all = 0.5
##  and there are no factor predictors; no plot no. 5

effect_A <- response[2]+response[4]+response[6]+response[8]+response[10]+response[12]+response[14]+response[16]-response[1]-response[3]-response[5]-response[7]-response[9]-response[11]-response[13]-response[15]
effect_B <- response[3]+response[4]+response[7]+response[8]+response[11]+response[12]+response[15]+response[16]-response[1]-response[2]-response[5]-response[6]-response[9]-response[10]-response[13]-response[14]
effect_C <- response[5]+response[6]+response[7]+response[8]+response[13]+response[14]+response[15]+response[16]-response[1]-response[2]-response[3]-response[4]-response[9]-response[10]-response[11]-response[12]
effect_D <- response[9]+response[10]+response[11]+response[12]+response[13]+response[14]+response[15]+response[16]-response[1]-response[2]-response[3]-response[4]-response[5]-response[6]-response[7]-response[8]
effect_A # Factor A effect
## [1] 50.57
effect_B # Factor B effect
## [1] -24.03
effect_C # Factor C effect
## [1] -3.53
effect_D # Factor D effect
## [1] -1.27
beta_1 <- 0.5*effect_A # Regression Coefficient 1
beta_2 <- 0.5*effect_B # Regression Coefficient 2 
beta_3 <- 0.5*effect_C # Regression Coefficient 3
mean(response) # grand mean of response
## [1] 4.680625
qqnorm(response,main="NPP of Response")

response <- log(response) # doing log transformation of data
dat <- as.data.frame(cbind(A,B,C,D,response))
model <- lm(response~A*B*C*D,data=dat)
halfnormal(model)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] A     B     A:B:C

effect_A <- response[2]+response[4]+response[6]+response[8]+response[10]+response[12]+response[14]+response[16]-response[1]-response[3]-response[5]-response[7]-response[9]-response[11]-response[13]-response[15]
effect_B <- response[3]+response[4]+response[7]+response[8]+response[11]+response[12]+response[15]+response[16]-response[1]-response[2]-response[5]-response[6]-response[9]-response[10]-response[13]-response[14]
effect_C <- response[5]+response[6]+response[7]+response[8]+response[13]+response[14]+response[15]+response[16]-response[1]-response[2]-response[3]-response[4]-response[9]-response[10]-response[11]-response[12]
effect_D <- response[9]+response[10]+response[11]+response[12]+response[13]+response[14]+response[15]+response[16]-response[1]-response[2]-response[3]-response[4]-response[5]-response[6]-response[7]-response[8]
effect_A # Factor A effect
## [1] 13.00593
effect_B # Factor B effect
## [1] -5.028441
effect_C # Factor C effect
## [1] -0.1025369
effect_D # Factor D effect
## [1] -0.2892382
(a) Factor effects are 50.57, -24.03, -3.53, -1.27 for Factors A, B, C, D, respectively.
(b) Factor D was removed from the design, because it was found to be not significant from the half-normal plot. The residual plot of the fitted model indicates model inadequacy, because the range of the residuals are not roughly constant.
(c) After performing a log transformation, interaction AB is no longer significant. Factor A, Factor B, and Interaction ABC are still significant after the log transformation.
(d) Regression Model: \(\hat y\) = 4.680625+25.285\(x_{1}\)-12.015\(x_{2}\)-1.765\(x_{3}\) This regression equation can be used to fit the model.

Problem 6.39

\(H_{0}\): (\(\tau \beta_{ij}\)) = 0
\(H_{1}\): At least one (\(\tau \beta_{ij}\)) \(\neq\) 0
a <- c(-1,1)
b <- c(-1,-1,1,1)
c <- c(-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)
A <- c(rep(a,16))
B <- c(rep(b,8))
C <- c(rep(c,4))
D <- c(rep(d,2))
E <- c(rep(-1,16),rep(1,16))
response <- c(8.11,5.56,5.77,5.82,9.17,7.8,3.23,5.69,8.82,14.23,9.2,8.94,8.68,11.49,6.25,9.12,7.93,5,7.47,12,9.86,3.65,6.4,11.61,12.43,17.55,8.87,25.38,13.06,18.85,11.78,26.05)
dat <- as.data.frame(cbind(A,B,C,D,E,response))
model <- lm(response~A*B*C*D*E,data=dat)
halfnormal(model)
## 
## Significant effects (alpha=0.05, Lenth method):
##  [1] D     E     A:D   A     D:E   B:E   A:B   A:B:E A:E   A:D:E

model <- aov(response~A*B*D*E,data=dat)
plot(model)

## hat values (leverages) are all = 0.5
##  and there are no factor predictors; no plot no. 5

interaction.plot(A,D,response)

interaction.plot(D,E,response)

interaction.plot(B,E,response)

interaction.plot(A,B,response)

interaction.plot(A,E,response)

dat <- as.data.frame(cbind(A,B,D,E,response))
model <- lm(response~A*B*D*E,data=dat)
halfnormal(model)
## 
## Significant effects (alpha=0.05, Lenth method):
##  [1] D     E     A:D   A     D:E   B:E   A:B   A:B:E A:E   A:D:E e10

interaction.plot(A,D,response)

interaction.plot(D,E,response)

interaction.plot(B,E,response)

interaction.plot(A,B,response)

interaction.plot(A,E,response)

effect_A <- (response[2]+response[4]+response[6]+response[8]+response[10]+response[12]+response[14]+response[16]+response[18]+response[20]+response[22]+response[24]+response[26]+response[28]+response[30]+response[32])-(response[1]+response[3]+response[5]+response[7]+response[9]+response[11]+response[13]+response[15]+response[17]+response[19]+response[21]+response[23]+response[25]+response[27]+response[29]+response[31])
effect_B <-sum(response[3:4]+response[7:8]+response[11:12]+response[15:16]+response[19:20]+response[23:24]+response[27:28]+response[31:32])-sum(response[1:2]+response[5:6]+response[9:10]+response[13:14]+response[17:18]+response[21:22]+response[25:26]+response[29:30])
effect_D <-sum(response[9:16]+response[25:32])-sum(response[1:8]+response[17:24])
effect_E <-sum(response[1:16])-sum(response[17:32])
effect_A # Factor Effect A
## [1] 51.71
effect_B # Factor Effect B
## [1] 1.39
effect_D # Factor Effect D
## [1] 95.63
effect_E # Factor Effect E
## [1] -70.01
mean(response) # grand mean of response
## [1] 10.18031
(a) Factor A,D,E are significant. Because interaction A:B is also significant, Factor B is also significant. Interactions AD, DE, BE, AB, ABE, AE, ADE are also significant.
(b) The ANOVA shows that the data has constant variance and normality may be assumed, based off the residuals plot and normal probability plot.
(c) Factor C is not significant. If this factor is dropped, then this experiment becomes a \(2^4\) factorial design. After re-analyzing the data with four factors, the half normal plots and interaction plots are the same between the \(2^4\) and \(2^5\) designs.
(d) Regression Model: \(\hat y\) = 10.18031+25.855\(x_{1}\)+0.695\(x_{2}\)+47.815\(x_{4}\)-35.0105\(x_{5}\) Using this regression model, it was determined that setting Factors A,B, and D to their high and Factor E to its low will maximize the response.

R Code

library(DoE.base)
c1 <- c(21,23,20,37,38,35)
c2 <- c(22,28,26,39,38,36)
c3 <- c(25,24,29,31,29,30)
c4 <- c(26,25,27,34,33,35)
response <- c(c1,c2,c3,c4)
culture <- c(rep(-1,12),rep(1,12))
time <- rep(c(rep(-1,3),rep(1,3)),4)
dat <- as.data.frame(cbind(response,culture,time))
model <- lm(response~culture*time,data=dat)
halfnormal(model)
interaction.plot(culture,time,response)
model <- aov(response~culture*time,data=dat)
summary(model)
plot(model)
A <- c(-1,1,-1,1)
B <- c(-1,-1,1,1)
AB <- A*B
Factor <- cbind(A,B,AB)
Factor
I <- c(14.037,13.880,14.821,14.888)
II <- c(16.165,13.860,14.757,14.921)
III <- c(13.972,14.032,14.843,14.415)
IV <- c(13.907,13.914,14.878,14.932)
response <- cbind(I,II,III,IV)
mean(c(I,II,III,IV))
dat <- as.data.frame(cbind(A,B,AB,response))
dat$total <- c(sum(dat[1,4:7]),sum(dat[2,4:7]),sum(dat[3,4:7]),sum(dat[4,4:7]))
effect_A <- (-dat[1,8]-dat[3,8])+(dat[2,8]+dat[4,8]) # effect of factor A
effect_B <- (-dat[1,8]-dat[2,8])+(dat[3,8]+dat[4,8]) # effect of factor B
effect_AB <- dat[1,8]+dat[4,8]-dat[2,8]-dat[3,8] # effect of factor interaction AB
dat
effect_A
effect_B
effect_AB
A <- rep(A,4)
B <- rep(B,4)
response <- c(I,II,III,IV)
dat <- as.data.frame(cbind(A,B,response))
model <- aov(response~A+B+A*B,data=dat)
summary(model)
plot(model)
model <- lm(response~A+B+A*B,data=dat)
halfnormal(model)
interaction.plot(A,B,response)
y1 <- 14.51388-2.538-4.688
y2 <- 14.51388+2.538-4.688 # residuals calculations
y3 <- 14.51388-2.538+4.688
y4 <- 14.51388+2.538+4.688

e1 <- I[1]-y1
e2 <- II[1]-y1
e3 <- III[1]-y1 # Residuals calculations
e4 <- IV[1]-y1
e5 <- I[2]-y2
e6 <- II[2]-y2
e7 <- III[2]-y2
e8 <- IV[2]-y2
e9 <- I[3]-y3
e10 <- II[3]-y3
e11 <- III[3]-y3
e12 <- IV[3]-y3
e13 <- I[4]-y4
e14 <- II[4]-y4
e15 <- III[4]-y4
e16 <- IV[4]-y4
residuals <- c(e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16)
residuals
A <- rep(rep(c(-1,1),8),7) # Factor A
B <- rep(rep(c(1,1,-1,-1),4),7) # Factor B
C <- rep(rep(c(rep(1,4),rep(-1,4)),2),7) # Factor C
D <- rep(c(rep(1,8),rep(-1,8)),7) # Factor D
I <- c(10.0,0.0,4.0,0.0,0.0,5.0,6.5,16.5,4.5,19.5,15.0,41.5,8.0,21.5,0.0,18.0)
II <- c(18.0,16.5,6.0,10.0,0.0,20.5,18.5,4.5,18.0,18.0,16.0,39.0,4.5,10.5,0.0,5.0)
III <- c(14.0,4.5,1.0,34.0,18.5,18.0,7.5,0.0,14.5,16.0,8.5,6.5,6.5,6.5,0.0,7.0)
IV <- c(12.5,17.5,14.5,11.0,19.5,20.0,6.0,23.5,10.0,5.5,0.0,3.5,10.0,0.0,4.5,10.0)
V <- c(19.0,20.5,12.0,25.5,16.0,29.5,0.0,8.0,0.0,10.0,0.5,7.0,13.0,15.5,1.0,32.5)
VI <- c(16.0,17.5,14.0,21.5,15.0,19.0,10.0,8.0,17.5,7.0,9.0,8.5,41.0,24.0,4.0,18.5)
VII <- c(18.5,33.0,5.0,0.0,11.0,10.0,0.0,8.0,6.0,36.0,3.0,36.0,14.0,16.0,6.5,8.0)
response <- c(I,II,III,IV,V,VI,VII)
dat <- as.data.frame(cbind(A,B,C,D,response))
model <- lm(response~A*B*C*D,data=dat)
halfnormal(model)
model <- aov(response~A*B,data=dat)
plot(model)
a <- c(-1,1)
b <- c(-1,-1,1,1)
c <- c(-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)
A <- c(rep(a,8))
B <- c(rep(b,4))
C <- c(rep(c,2))
D <- c(rep(d,1))
response <- c(1.92,11.28,1.09,5.75,2.13,9.53,1.03,5.35,1.60,11.73,1.16,4.68,2.16,9.11,1.07,5.30)
dat <- as.data.frame(cbind(A,B,C,D,response))
model <- lm(response~A*B*C*D,data=dat)
halfnormal(model)
model <- aov(response~A*B*C,data=dat)
summary(model)
plot(model)
effect_A <- response[2]+response[4]+response[6]+response[8]+response[10]+response[12]+response[14]+response[16]-response[1]-response[3]-response[5]-response[7]-response[9]-response[11]-response[13]-response[15]
effect_B <- response[3]+response[4]+response[7]+response[8]+response[11]+response[12]+response[15]+response[16]-response[1]-response[2]-response[5]-response[6]-response[9]-response[10]-response[13]-response[14]
effect_C <- response[5]+response[6]+response[7]+response[8]+response[13]+response[14]+response[15]+response[16]-response[1]-response[2]-response[3]-response[4]-response[9]-response[10]-response[11]-response[12]
effect_D <- response[9]+response[10]+response[11]+response[12]+response[13]+response[14]+response[15]+response[16]-response[1]-response[2]-response[3]-response[4]-response[5]-response[6]-response[7]-response[8]
effect_A # Factor A effect
effect_B # Factor B effect
effect_C # Factor C effect
effect_D # Factor D effect
beta_1 <- 0.5*effect_A # Regression Coefficient 1
beta_2 <- 0.5*effect_B # Regression Coefficient 2 
beta_3 <- 0.5*effect_C # Regression Coefficient 3
mean(response) # grand mean of response
qqnorm(response,main="NPP of Response")
response <- log(response) # doing log transformation of data
dat <- as.data.frame(cbind(A,B,C,D,response))
model <- lm(response~A*B*C*D,data=dat)
halfnormal(model)
effect_A <- response[2]+response[4]+response[6]+response[8]+response[10]+response[12]+response[14]+response[16]-response[1]-response[3]-response[5]-response[7]-response[9]-response[11]-response[13]-response[15]
effect_B <- response[3]+response[4]+response[7]+response[8]+response[11]+response[12]+response[15]+response[16]-response[1]-response[2]-response[5]-response[6]-response[9]-response[10]-response[13]-response[14]
effect_C <- response[5]+response[6]+response[7]+response[8]+response[13]+response[14]+response[15]+response[16]-response[1]-response[2]-response[3]-response[4]-response[9]-response[10]-response[11]-response[12]
effect_D <- response[9]+response[10]+response[11]+response[12]+response[13]+response[14]+response[15]+response[16]-response[1]-response[2]-response[3]-response[4]-response[5]-response[6]-response[7]-response[8]
effect_A # Factor A effect
effect_B # Factor B effect
effect_C # Factor C effect
effect_D # Factor D effect
a <- c(-1,1)
b <- c(-1,-1,1,1)
c <- c(-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)
A <- c(rep(a,16))
B <- c(rep(b,8))
C <- c(rep(c,4))
D <- c(rep(d,2))
E <- c(rep(-1,16),rep(1,16))
response <- c(8.11,5.56,5.77,5.82,9.17,7.8,3.23,5.69,8.82,14.23,9.2,8.94,8.68,11.49,6.25,9.12,7.93,5,7.47,12,9.86,3.65,6.4,11.61,12.43,17.55,8.87,25.38,13.06,18.85,11.78,26.05)
dat <- as.data.frame(cbind(A,B,C,D,E,response))
model <- lm(response~A*B*C*D*E,data=dat)
halfnormal(model)
model <- aov(response~A*B*D*E,data=dat)
plot(model)
interaction.plot(A,D,response)
interaction.plot(D,E,response)
interaction.plot(B,E,response)
interaction.plot(A,B,response)
interaction.plot(A,E,response)
dat <- as.data.frame(cbind(A,B,D,E,response))
model <- lm(response~A*B*D*E,data=dat)
halfnormal(model)
interaction.plot(A,D,response)
interaction.plot(D,E,response)
interaction.plot(B,E,response)
interaction.plot(A,B,response)
interaction.plot(A,E,response)
effect_A # Factor Effect A
effect_B # Factor Effect B
effect_D # Factor Effect D
effect_E # Factor Effect E
mean(response) # grand mean of response