# one way ANOVA tire<-read.csv("c:/RData/tire.csv", header=T) tire attach(tire) str(tire) detach(tire) tire1<-read.csv("c:/RData/tire_1.csv", header=T) tire1 str(tire1) tire1$brand1<-as.factor(tire1$brand1) str(tire1) tire<-read.csv("c:/RData/tire.csv", header=T) tire attach(tire) table(brand) tapply(life, brand, summary) tapply(life, brand, sd) boxplot(life~brand, main="tire life by brand", yaxt="n", xlab="brand", ylab="life", col=terrain.colors(4)) fit <- aov(life ~ brand, data=tire) fit anova(fit) model <- lm(life ~ brand, data=tire) model anova(model) # Fisher LSD install.packages("agricolae") library(agricolae) fit<-aov(life ~ brand, data=tire) out <- LSD.test(fit,"brand", p.adj="none") out LSD <- qt(1-0.025, 40-4)*sqrt(30.84617*(1/10+1/10)) LSD # Scheffe comparison <- scheffe.test(fit,"brand", group=TRUE, console=TRUE, main="Life of tire with different brand") comparison diff <- sqrt((4-1)*qf(1-0.05, 4-1, 40-4)*30.84617*(1/10+1/10)) diff