data(AndersonBias)
### Covert data to long format
Long = AndersonBias[rep(row.names(AndersonBias), AndersonBias$Count),
c("Result", "County", "Gender")]
rownames(Long) = seq(1:nrow(Long))
str(Long)
### Fit model and determine count r-square
model = glm(Result ~ County + Gender + County:Gender,
data = Long,
family = binomial())
countRSquare(model)
Run the code above in your browser using DataLab