Question 3.29

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
A<-read.csv("C:/R Activities/Week 6/Homework/329.csv")
colnames(A)<-c("Method","Count")

Question 3.29A

Hypothesis H0: M1=M2…=Mi H1:At least one of the Means differs.

model<-aov(Count~Method, data = A)
summary(model)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## Method       2   8964    4482   7.914 0.00643 **
## Residuals   12   6796     566                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

With the p value = 0.00643,we can conclude that at least one method has different

effect on particle count.

Question 3.29B

lm.model<-lm(Count~Method, data = A)
res<-resid(lm.model)
qqnorm(res, main = "NP of Residuals")
qqline(res)

plot(fitted(lm.model),res, main = "Residuals vs Fitted")
abline(0,0)

boxplot(Count~Method, data = A, main="Boxplot of observations")

From the Normal Plot of residuals we can see the normality assumption is not valid.

The plot of residuals versus predicted has a funnel shape,

#which indicates the variance of the original observations is not constant.

From boxplot We can see difference in percentile ranges indicating difference in means

#The scale is high 0-100, difficult to see the means are equal

Using Box-Cox power transformation to stabilize variance

Question 3.29C

library(MASS)
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
boxcox(Count~Method, data = A)

# 1 is not in CI on lambda
lambda=.5  #Square root transformation 
A$Count<-A$Count^lambda

Verifying data after transformation

boxcox(Count~Method, data = A)

boxplot(Count~Method, data = A, main="Boxplot of transformed observations ")

model<-aov(Count~Method, data = A)
summary(model)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## Method       2  63.90   31.95    9.84 0.00295 **
## Residuals   12  38.96    3.25                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

p value = 0.00643. The difference between methods is much more apparent

after applying the square root transformation.