5.4

feedrate <- c(rep(0.2,3),rep(0.25,3),rep(0.3,3),rep(0.2,3),rep(0.25,3),rep(0.3,3),rep(0.2,3),rep(0.25,3),rep(0.3,3),rep(0.2,3),rep(0.25,3),rep(0.3,3))
depth <- c(rep(0.15,9),rep(0.18,9),rep(0.20,9),rep(0.25,9))
obs <- c(74,64,60,92,86,88,99,98,102,79,68,73,98,104,88,104,99,95,82,88,92,99,108,95,108,110,99,99,104,96,104,110,99,114,111,107)
depth <- as.factor(depth)
feedrate <- as.factor(feedrate)
dat <- data.frame(depth,feedrate,obs)

a)

model <- aov(obs~depth+feedrate+depth*feedrate, data = dat)
summary(model)
##                Df Sum Sq Mean Sq F value   Pr(>F)    
## depth           3 2125.1   708.4  24.663 1.65e-07 ***
## feedrate        2 3160.5  1580.2  55.018 1.09e-09 ***
## depth:feedrate  6  557.1    92.8   3.232    0.018 *  
## Residuals      24  689.3    28.7                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

As illustrated in the ANOVA results, effects of both factors and their interaction is significant (\(\alpha=0.05\)).

b)

plot(model,2)

From the residuals plots we can see that the data seems to have a normal distribution.

plot(model,1)

From this plot, it seems that the variance is fairly constant.

c)

factor_means <- by(obs, feedrate, mean)
factor_sd <- by(obs, feedrate, sd)
print(factor_means)
## feedrate: 0.2
## [1] 81.58333
## ------------------------------------------------------------ 
## feedrate: 0.25
## [1] 97.58333
## ------------------------------------------------------------ 
## feedrate: 0.3
## [1] 103.8333
print(factor_sd)
## feedrate: 0.2
## [1] 14.33659
## ------------------------------------------------------------ 
## feedrate: 0.25
## [1] 8.005207
## ------------------------------------------------------------ 
## feedrate: 0.3
## [1] 6.072791

The mean values are shown in the table below:

Feed rate 0.20 Feed rate 0.25 Feed rate 0.30
81.58 \(\pm\) 14.34 97.58 \(\pm\) 8.00 103.83 \(\pm\) 6.07

d)

summary(model)
##                Df Sum Sq Mean Sq F value   Pr(>F)    
## depth           3 2125.1   708.4  24.663 1.65e-07 ***
## feedrate        2 3160.5  1580.2  55.018 1.09e-09 ***
## depth:feedrate  6  557.1    92.8   3.232    0.018 *  
## Residuals      24  689.3    28.7                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The p-values for feed rate, depth and their interaction are respectively 1.65e-07,1.09e-09 and, 0.018.

5.34

block <- c(seq(1,3),seq(1,3),seq(1,3),seq(1,3),seq(1,3),seq(1,3),seq(1,3),seq(1,3),seq(1,3),seq(1,3),seq(1,3),seq(1,3))
block <- as.factor(block)
dat1 <- data.frame(block,depth,feedrate,obs)
model1 <- aov(obs~block+depth+feedrate+depth*feedrate,data = dat1)
summary(model1)
##                Df Sum Sq Mean Sq F value   Pr(>F)    
## block           2  180.7    90.3   3.907  0.03532 *  
## depth           3 2125.1   708.4  30.637 4.89e-08 ***
## feedrate        2 3160.5  1580.2  68.346 3.64e-10 ***
## depth:feedrate  6  557.1    92.8   4.015  0.00726 ** 
## Residuals      22  508.7    23.1                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

While all factors were already significant, introducing the block, did reduce their respective p-value which means that the blocking was usefull.

13.5

library(GAD)
pos <- c(rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3))
temp <- c(rep(800,6),rep(825,6),rep(850,6))
obs <- c(570,565,583,528,547,521,1063,1080,1043,988,1026,1004,565,510,590,526,538,532)
pos <- as.random(pos)
temp <- as.fixed(temp)
dat2 <- data.frame(pos,temp,obs)
model2 <- aov(obs~pos*temp)
gad(model2)
## Analysis of Variance Table
## 
## Response: obs
##          Df Sum Sq Mean Sq  F value    Pr(>F)    
## pos       1   7160    7160   15.998 0.0017624 ** 
## temp      2 945342  472671 1155.518 0.0008647 ***
## pos:temp  2    818     409    0.914 0.4271101    
## Residual 12   5371     448                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

From these results we can see that while both effects are significant (\(\alpha=0.05\)), their interaction is not.

13.6

part <- c(rep(1,6),rep(2,6),rep(3,6),rep(4,6),rep(5,6),rep(6,6),rep(7,6),rep(8,6),rep(9,6),rep(10,6))
operator <- c(rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3))
obs <- c(50,49,50,50,48,51,52,52,51,51,51,51,53,50,50,54,52,51,49,51,50,48,50,51,48,49,48,48,49,48,52,50,50,52,50,50,51,51,51,51,50,50,52,50,49,53,48,50,50,51,50,51,48,49,47,46,49,46,47,48)
part <- as.random(part)
operator <- as.fixed(operator)
dat3 <- data.frame(part,operator,obs)
model3 <- aov(obs~operator*part)
gad(model3)
## Analysis of Variance Table
## 
## Response: obs
##               Df Sum Sq Mean Sq F value    Pr(>F)    
## operator       1  0.417  0.4167  0.6923    0.4269    
## part           9 99.017 11.0019  7.3346 3.216e-06 ***
## operator:part  9  5.417  0.6019  0.4012    0.9270    
## Residual      40 60.000  1.5000                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

These results suggest that the only siginificant factor is the part.