flicker <- read.delim("http://myweb.uiowa.edu/pbreheny/161/data/flicker.txt")
attach(flicker)
View(flicker)
fit <- aov(Flicker ~ Color)
summary(fit)
lmfit <- lm(Flicker ~ Color)
summary(lmfit)

null <- lm(Flicker~1) #Reduced model
complex <- lm(Flicker~as.factor(Color)) #complex model
SSR1 <- sum(null$residuals^2)
SSR2 <- sum(complex$residuals^2)
d0 <- 1 #Number of parameters of the reduced model
d1 <- 3 #Number of parameters of complex model
n <- 19
sigmahat <- SSR2/(n-d1)

((SSR1 - SSR2)/(d1-d0))/sigmahat

anova(null, complex)

TukeyHSD(fit)


pairwise.t.test(Flicker,Color,p.adj = "none")
pairwise.t.test(Flicker,Color,p.adj = "bonf")

