Created
February 20, 2012 23:04
-
-
Save pedroj/1872152 to your computer and use it in GitHub Desktop.
Example contingency table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------------------------------------------- | |
# Contingency table | |
#-------------------------------------------------- | |
# Productivity Smoking No smoking | |
# High 13 44 | |
# Low 25 29 | |
count<-c(13,25,44,29) | |
smoking<-factor(c("Yes","Yes","No","No")) | |
productivity<-factor(c("High","High","Low","Low")) | |
model<- glm(count~ smoking+productivity, poisson) | |
fitted(model) | |
countsummary(model) | |
model2<- update(model,~.-productivity, test="Chi") | |
1-pchisq(<valor-de-chi>,<df>) | |
#-------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment