#a
Life<-c(17.6,18.9,16.3,17.4,20.1,21.6,16.9,15.3,18.6,17.1,19.5,20.3,21.4,23.6,19.4,18.5,20.5,22.3,19.3,21.1,16.9,17.5,18.3,19.8)
FT<-rep(c("FT1","FT2","FT3","FT4"),each=6)
dat<-data.frame(Life,FT)
aov.model<-aov(Life~FT,data=dat)
summary(aov.model)
## Df Sum Sq Mean Sq F value Pr(>F)
## FT 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
With p-value=.053 being greater than \(\alpha=.05\), we do not have enough evidence to reject the null hypothesis that the life does not differ between fluids.
#b
boxplot(Life~FT)
If the objective is long life, then Fluid Type 3 would be the best choice.
#c
resmodel<-lm(Life~FT,data=dat)
res<-resid(resmodel)
plot(fitted(resmodel),res)
The plot of the residuals shows a relatively evenly sized distribution of the data across each of the fluid types.
#a
Time<-c(110,157,194,178,1,2,4,18,880,1256,5276,4355,495,7040,5307,10050,7,5,29,2)
Material<-rep(c("M1","M2","M3","M4","M5"),each=4)
dat2<-data.frame(Time,Material)
aov.model2<-aov(Time~Material,data=dat2)
summary(aov.model2)
## Df Sum Sq Mean Sq F value Pr(>F)
## Material 4 103191489 25797872 6.191 0.00379 **
## Residuals 15 62505657 4167044
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
With p-value=.004 being less than \(\alpha=.05\), we have enough evidence to reject the null hypothesis that the five materials have the same effect on mean failure time.
#b
resmodel2<-lm(Time~Material,data=dat2)
res2<-resid(resmodel2)
plot(fitted(resmodel2),res2)
qqnorm(res2)
The residual model displays that there is an unequal variance between the materials and the normal probability plot of the residuals is not aligned across the plot which demonstrates the data is not normally distributed.
#c
library(MASS)
boxcox(Time~Material)
The lambda in the boxcox transformation aligns near 0, which indicates the use of a log transformation of the data.
logTime<-log(Time)
dat3<-data.frame(logTime,Material)
aov.model3<-aov(logTime~Material,data=dat3)
summary(aov.model3)
## 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
With the p-value being much less than \(\alpha=.05\), we still have enough evidence to reject the null hypothesis that the five materials have the same effect on mean failure time.
#a
Count<-c(31,10,21,4,1,62,40,24,30,35,53,27,120,97,68)
Method<-rep(c("M1","M2","M3"),each=5)
dat4<-data.frame(Time,Material)
aov.model4<-aov(Time~Material,data=dat4)
summary(aov.model4)
## Df Sum Sq Mean Sq F value Pr(>F)
## Material 4 103191489 25797872 6.191 0.00379 **
## Residuals 15 62505657 4167044
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
With p-value=.003 being less than \(\alpha=.05\), we have enough evidence to reject the null hypothesis that the three methods have the same effect on mean particle count.
#b
resmodel4<-lm(Time~Material,data=dat4)
res4<-resid(resmodel4)
plot(fitted(resmodel4),res4)
qqnorm(res4)
The residual model displays that there is an unequal variance between the materials and the normal probability plot of the residuals is not aligned across the plot which demonstrates the data is not normally distributed.
#c
library(MASS)
boxcox(Count~Method)
The lambda in the boxcox transformation aligns near .33, which indicates the use of a lambda transformation of the data.
lambda=.33
lambdaCount<-Count^(lambda)
dat5<-data.frame(lambdaCount,Method)
aov.model5<-aov(lambdaCount~Method,data=dat5)
summary(aov.model5)
## Df Sum Sq Mean Sq F value Pr(>F)
## Method 2 9.238 4.619 9.77 0.00303 **
## Residuals 12 5.674 0.473
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
With p-value=.003 being less than \(\alpha=.05\), we still have enough evidence to reject the null hypothesis that the three methods have the same effect on mean particle count
kruskal.test(Life~FT,data=dat)
##
## Kruskal-Wallis rank sum test
##
## data: Life by FT
## Kruskal-Wallis chi-squared = 6.2177, df = 3, p-value = 0.1015
With p-value=.102 being greater than \(\alpha=.05\), we still do not have enough evidence to reject the null hypothesis that the life does not differ between fluids using the Kruskal-Wallis test. However, the p-value is almost double of the usual analysis of variance.
Both the usual analysis of variance and the Kruskal-Wallis test conclude that there is not enough evidence to reject the null hypothesis.
#install.packages("GAD")
library(GAD)
Strength<-c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
Chem<-rep(c("C1","C2","C3","C4"),each=5)
Bolt<-rep(c("B1","B2","B3","B4","B5"),4)
Chem<-as.fixed(Chem)
Bolt<-as.fixed(Bolt)
model<-lm(Strength~Chem+Bolt)
gad(model)
## $anova
## Analysis of Variance Table
##
## Response: Strength
## Df Sum Sq Mean Sq F value Pr(>F)
## Chem 3 12.95 4.317 2.3761 0.1211
## Bolt 4 157.00 39.250 21.6055 2.059e-05 ***
## Residuals 12 21.80 1.817
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
While the Bolt was an significant choice to make for the block, with a p-value=.121 being greater than \(\alpha=.05\), there is not enough evidence to reject the null hypothesis that tensile strengths are equal for all chemical agents.
\(\widehat{\tau} = \sqrt{\frac{SSTr}{J}} = \sqrt{\frac{12.95}{5}} = 1.609\)
\(\widehat{\beta} = \sqrt{\frac{SSB}{I}} = \sqrt{\frac{157}{4}} = 6.265\)
Time2<-c(8,7,1,7,3,11,2,7,3,8,4,9,10,1,5,6,8,6,6,10,4,2,3,8,8)
Batch<-rep(c("B1","B2","B3","B4","B5"),each=5)
Day<-rep(c("D1","D2","D3","D4","D5"),5)
Ingredient<-c("A","B","D","C","E","C","E","A","D","B","B","A","C","E","D","D","C","E","B","A","E","D","B","A","C")
Batch<-as.fixed(Batch)
Day<-as.fixed(Day)
Ingredient<-as.fixed(Ingredient)
dat6<-data.frame(Time2,Batch,Day,Ingredient)
model2<-lm(Time2~Batch+Day+Ingredient,data=dat6)
anova(model2)
## Analysis of Variance Table
##
## Response: Time2
## Df Sum Sq Mean Sq F value Pr(>F)
## Batch 4 15.44 3.860 1.2345 0.3476182
## Day 4 12.24 3.060 0.9787 0.4550143
## Ingredient 4 141.44 35.360 11.3092 0.0004877 ***
## Residuals 12 37.52 3.127
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
With p-values greater than \(\alpha=.05\) for both Batch and Day, these are not significant in rejecting the null hypothesis that the reaction time is equal across treatments. However, with a p-value=.0005, the Ingredient is significant enough to reject the former null hypothesis.