Required Libraries:

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
library(tidyr)
## Warning: package 'tidyr' was built under R version 4.1.3

Answer to question no 6.8

Entering the data:

time <- c(rep(-1,12), rep(1,12))
culture <- rep(c(rep(-1,2), rep(1,2)), 6)
observation <- c(21, 22, 25, 26,
                 23, 28, 24, 25,
                 20, 26, 29, 27,
                 37, 39, 31, 34,
                 38, 38, 29, 33,
                 35, 36, 30, 35)

Now, we analyze the model:

model eqn yijk = ai+bj+abij +eijk

where ai = factor 1 effect

bj = factor 2 effect

abij = 2 way interaction effect

eijk = error

Null hypothesis, Ho: ai = o

bj = 0

abij = 0

Alterantive hypothesis: Ha: ai≠ 0

bj ≠ 0

abij ≠ 0

Our ANOVA analysis is shown as follows:

anova6.8 <- aov(observation~time+culture+time*culture)
(lm((observation~time+culture+time*culture)))
## 
## Call:
## lm.default(formula = (observation ~ time + culture + time * culture))
## 
## Coefficients:
##  (Intercept)          time       culture  time:culture  
##       29.625         4.958        -0.625        -1.958
summary(anova6.8)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## time          1  590.0   590.0 115.506 9.29e-10 ***
## culture       1    9.4     9.4   1.835 0.190617    
## time:culture  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(anova6.8)

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

halfnormal(anova6.8)
## Warning in halfnormal.lm(anova6.8): halfnormal not recommended for models with
## more residual df than model df
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] time         time:culture e8

From our analysis of variance, we observe that the main effect Time and the interaction between time and culture has a significant effect for an alpha level of 0.05. Also from the half normal plot we do see that they are the outlier points indicating that they are significant parameters for the model.

From the residual plots, we see that the residuals have equal spread indicating the consideration of constant variance good enough. Also the residuals seem to have a fairly normal distribution. Hence, we consider that our model is sufficiently adequate.

The co-efficient of the estimates are also shown in the result boxes.

Answer to question no 6.12

Entering the data:

A <- c(-1,1,-1,1)
B <- c(-1,-1,1,1)

Ax <- as.factor(A)
Bx <- as.factor(B)

Ax <- rep(Ax, rep(4,4))
Bx <- rep(Bx, rep(4,4))
obs <- c(14.037, 16.165, 13.972, 13.907,
         13.880, 13.860, 14.032, 13.914,
         14.821, 14.757, 14.843, 14.878,
         14.888, 14.921, 14.415, 14.932)

Part(a)

The effects are determined using the following formula:

effect = (contrast)*2/2^2(n)

Where, k = number of factors, n = replicates for each settings

The results are summarized in the table below:

summary(lm(obs~Ax*Bx))
## 
## Call:
## lm.default(formula = obs ~ Ax * Bx)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.61325 -0.14431 -0.00563  0.10188  1.64475 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  14.5203     0.2824  51.414 1.93e-15 ***
## Ax1          -0.5988     0.3994  -1.499    0.160    
## Bx1           0.3045     0.3994   0.762    0.461    
## Ax1:Bx1       0.5630     0.5648   0.997    0.339    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5648 on 12 degrees of freedom
## Multiple R-squared:  0.3535, Adjusted R-squared:  0.1918 
## F-statistic: 2.187 on 3 and 12 DF,  p-value: 0.1425

The estimates of A,B, and interaction terms are -0.59, 0.30, and 0.56.

Part(b)

model eqn yijk = ai+bj+abij +eijk

where ai = factor 1 effect

bj = factor 2 effect

abij = 2 way interaction effect

eijk = error

Null hypothesis, Ho: ai = o

bj = 0

abij = 0

Alterantive hypothesis: Ha: ai≠ 0

bj ≠ 0

abij ≠ 0

The analysis of variance is performed as follows:

anova6.12 <- aov(obs~Ax*Bx)
summary(anova6.12)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Ax           1  0.403  0.4026   1.262 0.2833  
## Bx           1  1.374  1.3736   4.305 0.0602 .
## Ax:Bx        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

From the ANOVA table, we observe that none of the main effects or the two-way interaction effect has any significant effect on the response variable. So, we fail to reject the null hypothesis for all the main effects and the interaction term.

part(c)

summary(lm(obs~Ax*Bx))
## 
## Call:
## lm.default(formula = obs ~ Ax * Bx)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.61325 -0.14431 -0.00563  0.10188  1.64475 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  14.5203     0.2824  51.414 1.93e-15 ***
## Ax1          -0.5988     0.3994  -1.499    0.160    
## Bx1           0.3045     0.3994   0.762    0.461    
## Ax1:Bx1       0.5630     0.5648   0.997    0.339    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5648 on 12 degrees of freedom
## Multiple R-squared:  0.3535, Adjusted R-squared:  0.1918 
## F-statistic: 2.187 on 3 and 12 DF,  p-value: 0.1425

We can write our regression eqn as follows:

y = 14.52 - 0.59a + 0.304b + 0.563ab

part(d)

plot(anova6.12)

From our observation of the residuals plot, we see that the residuals do not show equal variance width in the fitted vs residual plots. Thus, the consideration of equal variance is violated. We can conclude that the model is inadequate.

y = 14.52 - 0.59a + 0.304b + 0.563ab

part(e)

Since the interaction effects are not significant, we can choose any main effect settings as per our convenience to maximize our yield of the response vairable which is the epitaxal layer thickness.

Answer to question no 6.21

Entering the data:

putt <- read.csv(file.choose())
View(putt)
putt$Length <- as.factor(putt$Length)
putt$Type <- as.factor(putt$Type)
putt$Break <- as.factor(putt$Break)
putt$Slope <- as.factor(putt$Slope)

pl <-rep(putt$Length, rep(7,16))
pt <- rep(putt$Type, rep(7,16))
pb <- rep(putt$Break, rep(7,16))
ps <- rep(putt$Slope, rep(7,16))
puttobs <- as.vector(t(putt[,c(5:11)]))
str(puttobs)
##  num [1:112] 10 18 14 12.5 19 16 18.5 0 16.5 4.5 ...

Part(a)

We perform ANOVA for the 2^4 design with replication as follows:

anova6.21 <- aov(puttobs~pl*pt*pb*ps)
summary(anova6.21)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## pl           1    917   917.1  10.588 0.00157 **
## pt           1    388   388.1   4.481 0.03686 * 
## pb           1    145   145.1   1.676 0.19862   
## ps           1      1     1.4   0.016 0.89928   
## pl:pt        1    219   218.7   2.525 0.11538   
## pl:pb        1     12    11.9   0.137 0.71178   
## pt:pb        1    115   115.0   1.328 0.25205   
## pl:ps        1     94    93.8   1.083 0.30066   
## pt:ps        1     56    56.4   0.651 0.42159   
## pb:ps        1      2     1.6   0.019 0.89127   
## pl:pt:pb     1      7     7.3   0.084 0.77294   
## pl:pt:ps     1    113   113.0   1.305 0.25623   
## pl:pb:ps     1     39    39.5   0.456 0.50121   
## pt:pb:ps     1     34    33.8   0.390 0.53386   
## pl:pt:pb:ps  1     96    95.6   1.104 0.29599   
## Residuals   96   8316    86.6                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

From the results of our ANOVA analysis, we see that only the effect of Putt Length and Put type have significant main effects. Rest of all the factors or interactions does not seem to have any significant effect on the response variable.

Part(b)

plot(anova6.21)

From the residual vs fitted plots we can see that the quartile ranges have fluctuating values/ widths as we move along the fitted values. We can say the model is inadequate since the consideration of constant variance-which is a fundamental assumption ANOVA is violated.

Hence, the model is inadequate.

Answer to question no- 6.36

Entering data:

resA <- rep(c(-1,1),8)
resB <- rep(c(-1,-1,1,1),4)
resC <- rep(c(-1,-1,-1,-1,1,1,1,1),2)
resD <- c(rep(-1,8), rep(1,8))
resob <- 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)

Part(a)

The factor effects are visualized in the half normal plot as follows:

anova6.35 <- aov(resob~resA*resB*resC*resD)
summary(lm(resob~resA*resB*resC*resD))
## 
## Call:
## lm.default(formula = resob ~ resA * resB * resC * resD)
## 
## Residuals:
## ALL 16 residuals are 0: no residual degrees of freedom!
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)
## (Intercept)          4.68062        NaN     NaN      NaN
## resA                 3.16062        NaN     NaN      NaN
## resB                -1.50187        NaN     NaN      NaN
## resC                -0.22062        NaN     NaN      NaN
## resD                -0.07937        NaN     NaN      NaN
## resA:resB           -1.06938        NaN     NaN      NaN
## resA:resC           -0.29812        NaN     NaN      NaN
## resB:resC            0.22937        NaN     NaN      NaN
## resA:resD           -0.05687        NaN     NaN      NaN
## resB:resD           -0.04688        NaN     NaN      NaN
## resC:resD            0.02937        NaN     NaN      NaN
## resA:resB:resC       0.34437        NaN     NaN      NaN
## resA:resB:resD      -0.09688        NaN     NaN      NaN
## resA:resC:resD      -0.01063        NaN     NaN      NaN
## resB:resC:resD       0.09438        NaN     NaN      NaN
## resA:resB:resC:resD  0.14188        NaN     NaN      NaN
## 
## Residual standard error: NaN on 0 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:    NaN 
## F-statistic:   NaN on 15 and 0 DF,  p-value: NA
halfnormal(anova6.35)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] resA           resB           resA:resB      resA:resB:resC

The factor effect estimates are shown in the table above.

From the half normal plot we see that the main effects A and B are significant. There is a significant 2-way interaction between factor A and B. Also a significant 3-way interaction between factor A,B, and C.

Based on the half-normal plot, our tentative model is:

y = A+B+A*B+A*B*C+e

Part(b)

Fitting the model identified in part(a) as follows:

anova6.35new <- aov(resob~resA+resB+resA*resB+resA*resB*resC)
summary(anova6.35new)
##                Df Sum Sq Mean Sq  F value   Pr(>F)    
## resA            1 159.83  159.83 1563.061 1.84e-10 ***
## resB            1  36.09   36.09  352.937 6.66e-08 ***
## resC            1   0.78    0.78    7.616  0.02468 *  
## resA:resB       1  18.30   18.30  178.933 9.33e-07 ***
## resA:resC       1   1.42    1.42   13.907  0.00579 ** 
## resB:resC       1   0.84    0.84    8.232  0.02085 *  
## resA:resB:resC  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(anova6.35new)

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

From the analysis of the residuals, we see that the consideration of constant variance has been violated as seen in the residuals vs fitted plot. So, we can say that our strong assumption of ANOVA has been violated. Hence, the model is inadequate.

Part(c)

We perform log transform on the response data and check the plots and summary again:

resoblog <- log(resob)
anova6.35new1 <- aov(resoblog~resA*resB*resC*resD)
halfnormal(anova6.35new1)
## 
## Significant effects (alpha=0.05, Lenth method):
## [1] resA           resB           resA:resB:resC

After log-transformation, we see that the two-way interaction between A and B has turned out to be insignificant.

anova6.35new2 <- aov(resoblog~resA+resB+resA*resB*resC)
summary(anova6.35new2)
##                Df Sum Sq Mean Sq  F value   Pr(>F)    
## resA            1 10.572  10.572 1994.556 6.98e-11 ***
## resB            1  1.580   1.580  298.147 1.29e-07 ***
## resC            1  0.001   0.001    0.124  0.73386    
## resA:resB       1  0.010   0.010    1.839  0.21207    
## resA:resC       1  0.025   0.025    4.763  0.06063 .  
## resB:resC       1  0.000   0.000    0.054  0.82223    
## resA:resB:resC  1  0.064   0.064   12.147  0.00826 ** 
## Residuals       8  0.042   0.005                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(anova6.35new2)

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

Apparently, the transformation has not changed the residuals vs fitted plots to make the model seem any more adequate than the last model. Hence, the log transformation did not help much.

part(d)

The fitted model is obtained from the estimates of the linear regression model as follows:

anova6.35new2 <- lm(resoblog~resA+resB+resA*resB+resA*resB*resC)
summary(anova6.35new2)
## 
## Call:
## lm.default(formula = resoblog ~ resA + resB + resA * resB + resA * 
##     resB * resC)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.1030 -0.0203  0.0000  0.0203  0.1030 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1.185417   0.018201  65.129 3.44e-12 ***
## resA            0.812870   0.018201  44.660 6.98e-11 ***
## resB           -0.314278   0.018201 -17.267 1.29e-07 ***
## resC           -0.006409   0.018201  -0.352  0.73386    
## resA:resB      -0.024685   0.018201  -1.356  0.21207    
## resA:resC      -0.039724   0.018201  -2.182  0.06063 .  
## resB:resC      -0.004226   0.018201  -0.232  0.82223    
## resA:resB:resC  0.063434   0.018201   3.485  0.00826 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.0728 on 8 degrees of freedom
## Multiple R-squared:  0.9966, Adjusted R-squared:  0.9935 
## F-statistic: 330.2 on 7 and 8 DF,  p-value: 3.296e-09

The fitted equation then:

y = 1.19 + 0.81A - 0.31B - 0.006C - 0.024AB - 0.039AC - 0.004BC + 0.06 ABC

Answer to question no- 6.39

Entering the data:

relA <- rep(c(-1,1),16)
relB <- rep(c(-1,-1,1,1),8)
relC <- rep(c(-1,-1,-1,-1,1,1,1,1),4)
relD <- rep(c(rep(-1,8), rep(1,8)),2)
relE <- c(rep(-1,16), rep(1,16))



relobs <- 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)

Part(a)

The ANOVA results and the significant main and interaction effects are identified in the following sections:

anova6.39 <- aov(relobs~relA*relB*relC*relD*relE)
halfnormal(anova6.39)
## 
## Significant effects (alpha=0.05, Lenth method):
##  [1] relD           relE           relA:relD      relA           relD:relE      
## 
##  [6] relB:relE      relA:relB      relA:relB:relE relA:relE      relA:relD:relE

From the half-normal plot, we see that we have 3 significant main effects A,D,E. We have five 2-way interactions as follows: A*D, D*E, B*E, and A*B, A*E. We have two significant 3-way interaction terms - A*D*E and A*B*E.

Part(b)

The residuals in the new model (containing only the significant terms) are tested as follows:

anova6.39new <- aov(relobs~relD+relE+relA*relD+relA+relD*relE+
                      relB*relE+relA*relB+relA*relB*relE+relA*relE+
                      relA*relD*relE)
summary(anova6.39new <- lm(relobs~relD+relE+relA*relD+relA+relD*relE+
                      relB*relE+relA*relB+relA*relB*relE+relA*relE+
                      relA*relD*relE))
## 
## Call:
## lm.default(formula = relobs ~ relD + relE + relA * relD + relA + 
##     relD * relE + relB * relE + relA * relB + relA * relB * relE + 
##     relA * relE + relA * relD * relE)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.04875 -0.67375 -0.00687  0.65281  2.25375 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    10.18031    0.22548  45.150  < 2e-16 ***
## relD            2.98844    0.22548  13.254 2.30e-11 ***
## relE            2.18781    0.22548   9.703 5.24e-09 ***
## relA            1.61594    0.22548   7.167 6.10e-07 ***
## relB            0.04344    0.22548   0.193 0.849178    
## relD:relA       1.66656    0.22548   7.391 3.87e-07 ***
## relD:relE       1.38969    0.22548   6.163 5.07e-06 ***
## relE:relB       1.28344    0.22548   5.692 1.43e-05 ***
## relA:relB       1.23656    0.22548   5.484 2.28e-05 ***
## relE:relA       1.02719    0.22548   4.556 0.000192 ***
## relE:relA:relB  1.18531    0.22548   5.257 3.82e-05 ***
## relD:relE:relA  0.90156    0.22548   3.998 0.000706 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.275 on 20 degrees of freedom
## Multiple R-squared:  0.9643, Adjusted R-squared:  0.9447 
## F-statistic: 49.15 on 11 and 20 DF,  p-value: 5.069e-12
summary(anova6.39new)
## 
## Call:
## lm.default(formula = relobs ~ relD + relE + relA * relD + relA + 
##     relD * relE + relB * relE + relA * relB + relA * relB * relE + 
##     relA * relE + relA * relD * relE)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.04875 -0.67375 -0.00687  0.65281  2.25375 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    10.18031    0.22548  45.150  < 2e-16 ***
## relD            2.98844    0.22548  13.254 2.30e-11 ***
## relE            2.18781    0.22548   9.703 5.24e-09 ***
## relA            1.61594    0.22548   7.167 6.10e-07 ***
## relB            0.04344    0.22548   0.193 0.849178    
## relD:relA       1.66656    0.22548   7.391 3.87e-07 ***
## relD:relE       1.38969    0.22548   6.163 5.07e-06 ***
## relE:relB       1.28344    0.22548   5.692 1.43e-05 ***
## relA:relB       1.23656    0.22548   5.484 2.28e-05 ***
## relE:relA       1.02719    0.22548   4.556 0.000192 ***
## relE:relA:relB  1.18531    0.22548   5.257 3.82e-05 ***
## relD:relE:relA  0.90156    0.22548   3.998 0.000706 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.275 on 20 degrees of freedom
## Multiple R-squared:  0.9643, Adjusted R-squared:  0.9447 
## F-statistic: 49.15 on 11 and 20 DF,  p-value: 5.069e-12
plot(anova6.39new)

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

From the residual analysis we can conclude that the model is inadequate as the assumption of constant variance seems to be violated as per the residuals vs fitted value plot.

Part(c)

From our initial sets of observations, we see that the factor C does not appear to by itself or in interaction with other main effects as a significant parameter. so we drop it out of the model and check:

anova6.39new1 <- aov(relobs~relA*relB*relD*relE)
plot(anova6.39new1)

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

summary(anova6.39new1)
##                     Df Sum Sq Mean Sq F value   Pr(>F)    
## relA                 1  83.56   83.56  57.233 1.14e-06 ***
## relB                 1   0.06    0.06   0.041 0.841418    
## relD                 1 285.78  285.78 195.742 2.16e-10 ***
## relE                 1 153.17  153.17 104.910 1.97e-08 ***
## relA:relB            1  48.93   48.93  33.514 2.77e-05 ***
## relA:relD            1  88.88   88.88  60.875 7.66e-07 ***
## relB:relD            1   0.01    0.01   0.004 0.950618    
## relA:relE            1  33.76   33.76  23.126 0.000193 ***
## relB:relE            1  52.71   52.71  36.103 1.82e-05 ***
## relD:relE            1  61.80   61.80  42.328 7.24e-06 ***
## relA:relB:relD       1   3.82    3.82   2.613 0.125501    
## relA:relB:relE       1  44.96   44.96  30.794 4.40e-05 ***
## relA:relD:relE       1  26.01   26.01  17.815 0.000650 ***
## relB:relD:relE       1   0.05    0.05   0.035 0.854935    
## relA:relB:relD:relE  1   5.31    5.31   3.634 0.074735 .  
## Residuals           16  23.36    1.46                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

We do not observe any change in the model adequacy from the residual plots. Slight changes are observed in the F-statistic of all other main and interaction effects owing to the change in the DOF of the entire model for dropping out factor C.

Other than that, no other sigificant changes are seen when comparing to our initial results in part a.

part(d)

summary(lm(relobs~relD+relE+relA*relD+relA+relD*relE+
                      relB*relE+relA*relB+relA*relB*relE+relA*relE+
                      relA*relD*relE))
## 
## Call:
## lm.default(formula = relobs ~ relD + relE + relA * relD + relA + 
##     relD * relE + relB * relE + relA * relB + relA * relB * relE + 
##     relA * relE + relA * relD * relE)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.04875 -0.67375 -0.00687  0.65281  2.25375 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    10.18031    0.22548  45.150  < 2e-16 ***
## relD            2.98844    0.22548  13.254 2.30e-11 ***
## relE            2.18781    0.22548   9.703 5.24e-09 ***
## relA            1.61594    0.22548   7.167 6.10e-07 ***
## relB            0.04344    0.22548   0.193 0.849178    
## relD:relA       1.66656    0.22548   7.391 3.87e-07 ***
## relD:relE       1.38969    0.22548   6.163 5.07e-06 ***
## relE:relB       1.28344    0.22548   5.692 1.43e-05 ***
## relA:relB       1.23656    0.22548   5.484 2.28e-05 ***
## relE:relA       1.02719    0.22548   4.556 0.000192 ***
## relE:relA:relB  1.18531    0.22548   5.257 3.82e-05 ***
## relD:relE:relA  0.90156    0.22548   3.998 0.000706 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.275 on 20 degrees of freedom
## Multiple R-squared:  0.9643, Adjusted R-squared:  0.9447 
## F-statistic: 49.15 on 11 and 20 DF,  p-value: 5.069e-12

Now, the fitted model equation that can be used to maximize the yield is as follows:

Y = 10.18 + 2.98D + 2.18E + 1.61A + 0.04B + 1.67A*D + 1.38 D*E + 1.28B*E + 1.23A*B + 1.02A*E + 1.18A*B*E + 0.90A*D*E

Since all the terms are positive and have significant effect on the response var, we can use this to maximize the yield of the predicted response.

Complete Code Chunk:

#problem 6.8

time <- c(rep(-1,12), rep(1,12))
culture <- rep(c(rep(-1,2), rep(1,2)), 6)
observation <- c(21, 22, 25, 26,
                 23, 28, 24, 25,
                 20, 26, 29, 27,
                 37, 39, 31, 34,
                 38, 38, 29, 33,
                 35, 36, 30, 35)

anova6.8 <- aov(observation~time+culture+time*culture)
(lm((observation~time+culture+time*culture)))
summary(anova6.8)
plot(anova6.8)


#problem 6.12
library(dplyr)

A <- c(-1,1,-1,1)
B <- c(-1,-1,1,1)

Ax <- as.factor(A)
Bx <- as.factor(B)

Ax <- rep(Ax, rep(4,4))
Bx <- rep(Bx, rep(4,4))
obs <- c(14.037, 16.165, 13.972, 13.907,
         13.880, 13.860, 14.032, 13.914,
         14.821, 14.757, 14.843, 14.878,
         14.888, 14.921, 14.415, 14.932)


anova6.12 <- aov(obs~Ax*Bx)
summary(anova6.12)
halfnormal(anova6.12)
plot(anova6.12)


#Problem 6.21
library(tidyr)
putt <- read.csv(file.choose())
View(putt)
putt$Length <- as.factor(putt$Length)
putt$Type <- as.factor(putt$Type)
putt$Break <- as.factor(putt$Break)
putt$Slope <- as.factor(putt$Slope)

pl <-rep(putt$Length, rep(7,16))
pt <- rep(putt$Type, rep(7,16))
pb <- rep(putt$Break, rep(7,16))
ps <- rep(putt$Slope, rep(7,16))
puttobs <- as.vector(t(putt[,c(5:11)]))
str(puttobs)

anova6.21 <- aov(puttobs~pl*pt*pb*ps)
summary(anova6.21)
plot(anova6.21)

#problem 6.36
install.packages("DoE.base")
library(DoE.base)
resA <- rep(c(-1,1),8)
resB <- rep(c(-1,-1,1,1),4)
resC <- rep(c(-1,-1,-1,-1,1,1,1,1),2)
resD <- c(rep(-1,8), rep(1,8))
resob <- 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)



anova6.35 <- aov(resob~resA*resB*resC*resD)
halfnormal(anova6.35)
summary(anova6.35)

anova6.35new <- aov(resob~resA+resB+resA*resB+resA*resB*resC)
summary(anova6.35new)
plot(anova6.35new)

resoblog <- log(resob)
anova6.35new1 <- aov(resoblog~resA*resB*resC*resD)
halfnormal(anova6.35new1)

anova6.35new2 <- lm(resoblog~resA+resB+resA*resB*resC)
summary(anova6.35new2)


#problem 6.39
relA <- rep(c(-1,1),16)
relB <- rep(c(-1,-1,1,1),8)
relC <- rep(c(-1,-1,-1,-1,1,1,1,1),4)
relD <- rep(c(rep(-1,8), rep(1,8)),2)
relE <- c(rep(-1,16), rep(1,16))



relobs <- 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)

anova6.39 <- aov(relobs~relA*relB*relC*relD*relE)
halfnormal(anova6.39)

anova6.39new <- aov(relobs~relD+relE+relA*relD+relA+relD*relE+
                      relB*relE+relA*relB+relA*relB*relE+relA*relE+
                      relA*relD*relE)
summary(anova6.39new <- lm(relobs~relD+relE+relA*relD+relA+relD*relE+
                      relB*relE+relA*relB+relA*relB*relE+relA*relE+
                      relA*relD*relE))
summary(anova6.39new)
plot(anova6.39new)