Last active
August 29, 2015 14:06
-
-
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.
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
# 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