Homework week 10

Question 5.4

FeedRate <- c(rep("0.2",12), rep("0.25",12), rep("0.3",12))
DepthCut <- rep(c("0.15","0.18","0.2","0.25"), 9)
blocks <- c(rep(c(rep("1",4),rep("2",4),rep("3",4)),3))
obs <- c( 74,79,82,99,
          64,68,88,104,
          60,73,92,96,
          92,98,99,104,
          86,104,108,110,
          88,88,95,99,
          99,104,108,114,
          98,99,110,111,
          102,95,99,107 )

dat<- data.frame(FeedRate,DepthCut,obs)
dat$FeedRate <- as.fixed(dat$FeedRate)
dat$DepthCut <- as.fixed(dat$DepthCut)


model<-aov(obs~dat$FeedRate+dat$DepthCut+dat$FeedRate*dat$DepthCut)
#GAD
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: obs
##                           Df  Sum Sq Mean Sq F value    Pr(>F)    
## dat$FeedRate               2 3160.50 1580.25 55.0184 1.086e-09 ***
## dat$DepthCut               3 2125.11  708.37 24.6628 1.652e-07 ***
## dat$FeedRate:dat$DepthCut  6  557.06   92.84  3.2324   0.01797 *  
## Residual                  24  689.33   28.72                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

a)

The Hypotheses are:

Feed Rate Main Effect: H0 : αi = 0 ∀ i H1 : αi≠ 0 for at least one i

Depth of Cut Main Effect: H0 : βj = 0 ∀ j H1 : βj≠ 0 for at least one j

Feed Rate * Depth of Cut Interaction Effect: H0 : αβij = 0 ∀ ij H1 : αβij≠ 0 for at least one ij

We evaluate the hypothesis for the interaction effect: with a p-value of 0.018, it is not significant to an α = 0.05. Hence, we look at the main effects and find that both factors are significant, with p-values of <0.001 each.

b)

autoplot(model)

The residuals look normal and showing constant variance.

c)

dat %>%
  group_by(FeedRate) %>%
  summarise_at(vars(obs),
               list(name = mean))             
## # A tibble: 3 x 2
##   FeedRate  name
##   <fct>    <dbl>
## 1 0.2       81.6
## 2 0.25      97.6
## 3 0.3      104.

d)

P-value FeedRate = 1.086e-09
P-value DepthCut = 1.652e-07
P-value interaction = 0.01797

Question 5.34

dat$blocks <- as.factor(blocks)
model2<-aov(obs~dat$FeedRate+dat$DepthCut+dat$blocks+dat$FeedRate*dat$DepthCut)
summary(model2)
##                           Df Sum Sq Mean Sq F value   Pr(>F)    
## dat$FeedRate               2 3160.5  1580.2  68.346 3.64e-10 ***
## dat$DepthCut               3 2125.1   708.4  30.637 4.89e-08 ***
## dat$blocks                 2  180.7    90.3   3.907  0.03532 *  
## dat$FeedRate:dat$DepthCut  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
It does not appear that blocking was useful in this experiment

Question 13.5

Position <- rep(c(1,2),times=9)
Temperature <- rep(c(rep(800,2),rep(825,2),rep(850,2)),3)
BakedDensity <- c(570,528,1063,988,565,526,565,547,1080,1026,510,538,583,521,1043,1004,590,532)
dat1 <- as.data.frame(cbind(Position,Temperature,BakedDensity))

Position <- as.random(Position)
Temperature <- as.fixed(Temperature)

model1<-aov(BakedDensity~Position+Temperature+Position*Temperature)
GAD::gad(model1)
## Analysis of Variance Table
## 
## Response: BakedDensity
##                      Df Sum Sq Mean Sq  F value    Pr(>F)    
## Position              1   7160    7160   15.998 0.0017624 ** 
## Temperature           2 945342  472671 1155.518 0.0008647 ***
## Position:Temperature  2    818     409    0.914 0.4271101    
## Residual             12   5371     448                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The interaction effect is not significant at a p-value of 0.427. Hence, we can examine the main effects that are both significant with p-values of 0.0017624 and 0.0008647 and an alpha level of 0.05.

Question 13.6

dat2 <- read.csv("13.6.csv",header=TRUE)

partNumber <- dat2$ï..PartNumber
operator <- dat2$Operator
obs <- dat2$Obs

operator <- as.fixed(operator)
partNumber <- as.random(partNumber)

model2<-aov(obs~operator+partNumber+operator*partNumber)
GAD::gad(model2)
## Analysis of Variance Table
## 
## Response: obs
##                     Df Sum Sq Mean Sq F value    Pr(>F)    
## operator             1  0.267  0.2667  0.4186    0.5338    
## partNumber           9 98.400 10.9333  7.6279 2.061e-06 ***
## operator:partNumber  9  5.733  0.6370  0.4444    0.9022    
## Residual            40 57.333  1.4333                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The interaction effect is not significant at a p-value of 0.9022. Hence, we can examine the main effects      of Operator that is not significant with p-values = 0.5338 and PartNumber that is significant with p-value = 2.061e-06 and an alpha level of 0.05.