knitr::opts_chunk$set(echo = TRUE)
library(tidyr)
library(agricolae)
library(MASS)
Answer 3.23
Entering Data
FT1 <- c(17.6, 18.9, 16.3, 17.4, 20.1, 21.6)
FT2 <- c(16.9, 15.3, 18.6, 17.1, 19.5, 20.3)
FT3 <- c(21.4, 23.6, 19.4, 18.5, 20.5, 22.3)
FT4 <- c(19.3, 21.1, 16.9, 17.5, 18.3, 19.8)
FT <- cbind.data.frame(FT1, FT2, FT3, FT4)
FTs <- pivot_longer (data = FT, c(FT1, FT2, FT3, FT4))
FTs$name <- as.factor(FTs$name)
FTs$value <- as.numeric(FTs$value)
3.23 (a).
Stating the Hypothesis:
Null Hypothesis: \(H_o: \mu_1= \mu_2= \mu_3= \mu_4 = \mu_i\)
Alternative Hypothesis: \(H_a\): At least one of the \(\mu_i\) differs
dat1 <- aov(value~name, data = FTs)
summary(dat1)
## Df Sum Sq Mean Sq F value Pr(>F)
## name 3 30.16 10.05 3.047 0.0525 .
## Residuals 20 65.99 3.30
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From the above ANOVA test we see that the P-value = 0.0525 which is > alpha = 0.05. Hence we fail to reject the Null Hypothesis. This indicates that the mean life for all fluid types does not differ.
3.23 (b).
LSD.test(dat1,"name", alpha = 0.05, console = TRUE)
##
## Study: dat1 ~ "name"
##
## LSD t Test for value
##
## Mean Square Error: 3.299667
##
## name, means and individual ( 95 %) CI
##
## value std r LCL UCL Min Max
## FT1 18.65000 1.952178 6 17.10309 20.19691 16.3 21.6
## FT2 17.95000 1.854454 6 16.40309 19.49691 15.3 20.3
## FT3 20.95000 1.879096 6 19.40309 22.49691 18.5 23.6
## FT4 18.81667 1.554885 6 17.26975 20.36358 16.9 21.1
##
## Alpha: 0.05 ; DF Error: 20
## Critical Value of t: 2.085963
##
## least Significant Difference: 2.187666
##
## Treatments with the same letter are not significantly different.
##
## value groups
## FT3 20.95000 a
## FT4 18.81667 ab
## FT1 18.65000 b
## FT2 17.95000 b
As fluid type 3 has the higest average life, it should be selected if the objective is long life.
Answer 3.28
Entering Data
M1 <- c(110, 157, 194, 178)
M2 <- c(1, 2, 4, 18)
M3 <- c(880, 1256, 5276, 4355)
M4 <- c(495, 7040, 5307, 10050)
M5 <- c(7, 5, 29, 2)
MFT <- cbind.data.frame(M1, M2, M3, M4, M5)
MFTs <- pivot_longer (data = MFT, c(M1, M2, M3, M4, M5))
MFTs$name <- as.factor(MFTs$name)
MFTs$value <- as.numeric(MFTs$value)
3.28 (a).
Stating the Hypothesis:
Null Hypothesis: \(H_o: \mu_1= \mu_2= \mu_3= \mu_4 = \mu_i\)
Alternative Hypothesis: \(H_a\): At least one of the \(\mu_i\) differs
dat2 <- aov(value~name, data = MFTs)
summary(dat2)
## Df Sum Sq Mean Sq F value Pr(>F)
## name 4 103191489 25797872 6.191 0.00379 **
## Residuals 15 62505657 4167044
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From the above ANOVA test we see that the P-value = 0.00379 which is < alpha = 0.05. Hence we reject the Null Hypothesis. This indicates that atleast one of the mean differs.
3.28 (c).
boxcox(dat2)

Therefore, now we can see that the data is normally distributed and the residual vs fitted value plot shows that the variance is constant.From the ANOVA test we see that the P-value = 1.18e-07 which is < alpha = 0.05. Hence we reject the Null Hypothesis and conclude that atleast one of the mean differs.
Answer 3.29
Entering Data
Me1 <- c(31, 10, 21, 4, 1)
Me2 <- c(62, 40, 24, 30, 35)
Me3 <- c(53, 27, 120, 97, 68)
MeC <- cbind.data.frame(Me1, Me2, Me3)
MeCs <- pivot_longer (data = MeC, c(Me1, Me2, Me3))
MeCs$name <- as.factor(MeCs$name)
MeCs$value <- as.numeric(MeCs$value)
3.29 (a).
Stating the Hypothesis:
Null Hypothesis: \(H_o: \mu_1= \mu_2= \mu_3= \mu_4 = \mu_i\)
Alternative Hypothesis: \(H_a\): At least one of the \(\mu_i\) differs
dat3 <- aov(value~name, data = MeCs)
summary(dat3)
## Df Sum Sq Mean Sq F value Pr(>F)
## name 2 8964 4482 7.914 0.00643 **
## Residuals 12 6796 566
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From the above ANOVA test we see that the P-value = 0.00643 which is < alpha = 0.05. Hence we reject the Null Hypothesis and state that at least one of the methods has a different effect on the mean particle count.
3.29 (c).
boxcox(dat3)

Therefore, now we can see that the data is normally distributed and the residual vs fitted value plot shows that the variance is constant.From the ANOVA test we see that the P-value = 0.00291 which is < alpha = 0.05. Hence we reject the Null Hypothesis and conclude that atleast one of the mean differs.
Answer 3.51
kruskal.test(value~name, data = FTs)
##
## Kruskal-Wallis rank sum test
##
## data: value by name
## Kruskal-Wallis chi-squared = 6.2177, df = 3, p-value = 0.1015
We can see that P-value = 0.1015 is > than alpha = 0.05 hence we accept the Null Hypothesis and conclude that fluid does not differ. Also, the p-value obtained in the Kruskal-Wallis test is larger as compared to the one from the ANOVA test as it does not assume normality. Overall, our conclusion is same in both the methods.