Answer to Question no-5.2

(a) Blanks filled in the table above. The yellow highlighted underlined values indicate the ones which were asked for in the original question.

(b) Factor B had 4 levels since DOF = J-1 = 4-1 = 3

(c) Total number of replicates = (I*J*k)/(I*J) = 16/2*4 = 2 replicates for each factor and levels.

  1. Our model equation for the 2-factor with interaction is:

Yijk = µ + αi + βj +αβij + eijk

Where, µ = grand mean

αi = effect of factor A

βj = effect of factor B

αβij = 2-way interaction effect of factor 1 and 2

eijk = random error

Our hypothesis for the main and interaction effects are as follows:

Main effects,

Null hypothesis for effect-1, H0: αi = 0  

Alternative hypothesis for effect-1, Ha:  αi ≠ 0

Null hypothesis for effect-2, H0: βj = 0

Alternative hypothesis for effect-2, Ha:  βj ≠ 0

Interaction effect,

Null hypothesis for interaction effect, H0: αβij= 0

Alternative hypothesis for effect-1, Ha:  αβij ≠ 0

From our results we see that, for an alpha of 0.05, we fail to reject the null hypothesis

for the interaction and main effects since all the p-values are greater than our threshold alpha = 0.05. Hence, we conclude that

αi = 0  

βj = 0

αβij= 0

hence, there is no main or interaction effect present in the current model.

Answer to Question no-5.9

Required libraries and entering data:

library(GAD)
## Warning: package 'GAD' was built under R version 4.1.3
## Loading required package: matrixStats
## Warning: package 'matrixStats' was built under R version 4.1.3
## Loading required package: R.methodsS3
## Warning: package 'R.methodsS3' was built under R version 4.1.3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
drill <- c(rep(1,8), rep(2,8))
feedrate <- rep(seq(1,4),4)
drill
##  [1] 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2
feedrate
##  [1] 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
obs <- c(2.70, 2.45, 2.60, 2.75,
         2.78, 2.49, 2.72, 2.86,
         2.83, 2.85, 2.86, 2.94,
         2.86, 2.80, 2.87, 2.88)

data <- data.frame(drill,feedrate, obs)
data$drill <- as.fixed(data$drill)
data$feedrate <- as.fixed(data$feedrate)
str(data)
## 'data.frame':    16 obs. of  3 variables:
##  $ drill   : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 2 2 ...
##  $ feedrate: Factor w/ 4 levels "1","2","3","4": 1 2 3 4 1 2 3 4 1 2 ...
##  $ obs     : num  2.7 2.45 2.6 2.75 2.78 2.49 2.72 2.86 2.83 2.85 ...
View(data)

Running ANOVA based on the following model equation:

Yijk = µ + αi + βj +αβij + eijk

Where, µ = grand mean

αi = effect of factor 1 (drill type)

βj = effect of factor 2 ( feedrate)

αβij = 2-way interaction effect of factor 1 and 2

eijk = random error

Hypothesis testing:

Main effects,

Null hypothesis for effect-1, H0: αi = 0  

Alternative hypothesis for effect-1, Ha:  αi ≠ 0

Null hypothesis for effect-2, H0: βj = 0

Alternative hypothesis for effect-2, Ha:  βj ≠ 0

Interaction effect,

Null hypothesis for interaction effect, H0: αβij= 0

Alternative hypothesis for effect-1, Ha:  αβij ≠ 0

ANOVA results:

anova <- aov(obs~drill+feedrate+drill*feedrate, data = data)
summary(anova)
##                Df  Sum Sq Mean Sq F value   Pr(>F)    
## drill           1 0.14822 0.14822  57.010 6.61e-05 ***
## feedrate        3 0.09250 0.03083  11.859  0.00258 ** 
## drill:feedrate  3 0.04187 0.01396   5.369  0.02557 *  
## Residuals       8 0.02080 0.00260                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

From the results of ANOVA table, we see that there is a significant 2-way interaction effect ( p < 0.05). Hence, for the hypothesis testing on the interaction effect, we reject the null hypothesis that αβij= 0

Now, we observe the interaction plot between the two factors to get a better visual of the interaction event:

interaction.plot(x.factor = data$feedrate,
                 trace.factor = data$drill,
                 response = obs,
                 xlab = "Feedrate",
                 ylab = "Thrust Force",
                 col = c("Red", "Blue"),
                 lwd = 2)

From the interaction plot we can see that the change in the thrust force due to the change in drill types are different. In the figure, the legends drill 1 and 2 indicate drill speeds of 125 and 200 respectively. We can see that as the feedrate increases from 0.015 to 0.030, the thrust force shows slight negative correlation for a drill speed of 125. Contrarily, the negative correlation is much higher for a drill speed of 200. Again while changing the feedrate from 0.030 to 0.060, there is a slight positive correlation for drill speed of 125 (indicated by the blue line) and a much higher positive correlation (indicated by the red dotted line) for drill speed of 200.

Hence it is clear and evident that the interaction between the feedrate and the drill speed is a significant 2-way interaction event for the thrust force in the current experiment.

Complete Code Chunk:

#Problem 5.2
1 - pf(.00001, 1,8)
1 - pf(3.029, 3,8)
1 - pf(0.142, 3,8)
#Problem 5.9

library(GAD)

drill <- c(rep(1,8), rep(2,8))
feedrate <- rep(seq(1,4),4)
drill
feedrate
obs <- c(2.70, 2.45, 2.60, 2.75,
         2.78, 2.49, 2.72, 2.86,
         2.83, 2.85, 2.86, 2.94,
         2.86, 2.80, 2.87, 2.88)

data <- data.frame(drill,feedrate, obs)
data$drill <- as.fixed(data$drill)
data$feedrate <- as.fixed(data$feedrate)
str(data)
View(data)

anova <- aov(obs~drill+feedrate+drill*feedrate, data = data)
summary(anova)

?interaction.plot
interaction.plot(x.factor = data$feedrate,
                 trace.factor = data$drill,
                 response = obs,
                 xlab = "Feedrate",
                 ylab = "Thrust Force",
                 col = c("Red", "Blue"),
                 lwd = 2)