Question 3.23

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)
fluidType <- cbind(ft1,ft2,ft3,ft4)
combinedGroups <- data.frame(fluidType)
stackedGroups <- stack(combinedGroups)
dat <- aov(values~ind, data = stackedGroups)
summary(dat)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## ind          3  30.17   10.05   3.047 0.0525 .
## Residuals   20  65.99    3.30                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mean(ft1)
## [1] 18.65
mean(ft2)
## [1] 17.95
mean(ft3)
## [1] 20.95
mean(ft4)
## [1] 18.81667
Hypothesis Testing:

Null Hypothesis: \(H_o: \mu_1 = \mu_2 = \mu_3 = \mu_4\)

Alternative Hypothesis: \(H_a:\) At least \(\mu_i\) differs

  • Since our p-value (0.0525) is greater than our alpha (0.05) then we fail to reject the Null Hypothesis. This means that we accept that the means of the mean life of the fluid types are the same for all fluid types.

  • Fluid 3 has the longest life average so that would be the selected fluid based solely off of long life.

The plots show that the data is normally distributed. Furthermore, the residuals and the box plot checkout for constant variance.

Question 3.28

Hypothesis Testing:

Null Hypothesis: \(H_o: \mu_1 = \mu_2 = \mu_3 = \mu_4 =\mu5\)

Alternative Hypothesis: \(H_a:\) At least \(\mu_i\) differs

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)
materialType <- cbind(m1, m2, m3, m4, m5)
combinedGroup2 <- data.frame(materialType)
stackedGroup2 <- stack(combinedGroup2)
dat2 <- aov(values~ind, data = stackedGroup2)
summary(dat2)
##             Df    Sum Sq  Mean Sq F value  Pr(>F)   
## ind          4 103191489 25797872   6.191 0.00379 **
## Residuals   15  62505657  4167044                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(dat2)

boxcox(dat2)

  • Since our p-value (0.00379) is lest than our alpha (0.05) then we reject the Null Hypothesis. This means that all five fluids do not have the same effect on mean failure time?

  • The plot shows us that he assumptions of ANOVA do not hold.

  • To make the data more appropriate for the ANOVA test I did a log transformation because after performing boxcox I found lambda to be very close to zero so I thought a log transformations was appropriate.

  • Using the data from the log transformation I derived the p-value to be significantly less than Alpha ans we reject the Null Hypothesis.

logMaterialType <- log(materialType)
combinedGroup4 <- data.frame(logMaterialType)
stackedGroup4 <- stack(combinedGroup4)
colnames(stackedGroup4)<-c("failureTime_mins","material")
dat4 <- aov(failureTime_mins~material, data = stackedGroup4)
summary(dat4)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## material     4 165.06   41.26   37.66 1.18e-07 ***
## Residuals   15  16.44    1.10                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(dat4)

kruskal.test(failureTime_mins~material, data=stackedGroup4)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  failureTime_mins by material
## Kruskal-Wallis chi-squared = 16.873, df = 4, p-value = 0.002046

Question 3.29

method1 <- c(31,10,21,4,1)
method2<- c(62,40,24,30,35)
method3 <- c(53, 27, 120, 97,68)
methodType <- cbind(method1, method2, method3)
combinedGroup3 <- data.frame(methodType)
stackedGroup3 <- stack(combinedGroup3)
dat3 <- aov(values~ind, data = stackedGroup3)
summary(dat3)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## ind          2   8964    4482   7.914 0.00643 **
## Residuals   12   6796     566                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(dat3)

kruskal.test(values~ind, data=stackedGroup3)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  values by ind
## Kruskal-Wallis chi-squared = 8.54, df = 2, p-value = 0.01398

Question 3.51

kruskal.test(values~ind, data = stackedGroups)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  values by ind
## Kruskal-Wallis chi-squared = 6.2177, df = 3, p-value = 0.1015
summary(dat)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## ind          3  30.17   10.05   3.047 0.0525 .
## Residuals   20  65.99    3.30                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1