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")
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
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")
#which indicates the variance of the original observations is not constant.
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
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