Skip to content

Instantly share code, notes, and snippets.

@carlislerainey
Last active August 29, 2015 14:06
Show Gist options
  • Save carlislerainey/02ed2807888ac916b876 to your computer and use it in GitHub Desktop.
Save carlislerainey/02ed2807888ac916b876 to your computer and use it in GitHub Desktop.
An incomplete example of how to use predicted probabilities to be completed in class.
# load libraries
library(arm)
# read data
d <- read.csv("http://crain.co/am-files/data/turnout-small.csv")
# estimate simple logit model
m <- glm(vote ~ educate + age + income,
family = binomial, data = d)
# display results
display(m, detail = TRUE)
# what are the distributions of these variables?
par(mfrow = c(1, 3))
hist(d$educate) # in years
hist(d$age) # in years
hist(d$income) # in 10,000s of dollars
# what are the medians of these variables?
median(d$educate) # in years
median(d$age) # in years
median(d$income) # in 10,000s of dollars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment