data(DaytonSurvey)
# mutual independence
mod.0 <- glm(Freq ~ ., data=DaytonSurvey, family=poisson)
# mutual independence + GR
mod.GR <- glm(Freq ~ . + sex*race, data=DaytonSurvey, family=poisson)
anova(mod.GR, test = "Chisq")
# all two-way terms
mod.all2way <- glm(Freq ~ .^2, data=DaytonSurvey, family=poisson)
anova(mod.all2way, test = "Chisq")
# compare models
LRstats(mod.0, mod.GR, mod.all2way)
# collapse over sex and race
Dayton.ACM <- aggregate(Freq ~ cigarette+alcohol+marijuana,
data=DaytonSurvey,
FUN=sum)
Dayton.ACM
Run the code above in your browser using DataLab