Skip to content

Instantly share code, notes, and snippets.

@pedroj
Created February 20, 2012 23:04
Show Gist options
  • Save pedroj/1872152 to your computer and use it in GitHub Desktop.
Save pedroj/1872152 to your computer and use it in GitHub Desktop.
Example contingency table
#--------------------------------------------------
# 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