Description Usage Format Details Source Examples
Election results for the 2010 U.S. House of Represenatives races
1 |
A data frame with 435 observations on the following 24 variables.
idUnique identifier for the race, which does not overlap with other 2010 races (see govRace10 and senateRace10)
stateState name
abbrState name abbreviation
numDistrict number for the state
name1Name of the winning candidate
perc1Percentage of vote for winning candidate (if more than one candidate)
party1Party of winning candidate
votes1Number of votes for winning candidate
name2Name of candidate with second most votes
perc2Percentage of vote for candidate who came in second
party2Party of candidate with second most votes
votes2Number of votes for candidate who came in second
name3Name of candidate with third most votes
perc3Percentage of vote for candidate who came in third
party3Party of candidate with third most votes
votes3Number of votes for candidate who came in third
name4Name of candidate with fourth most votes
perc4Percentage of vote for candidate who came in fourth
party4Party of candidate with fourth most votes
votes4Number of votes for candidate who came in fourth
name5Name of candidate with fifth most votes
perc5Percentage of vote for candidate who came in fifth
party5Party of candidate with fifth most votes
votes5Number of votes for candidate who came in fifth
This analysis in the Examples section was inspired by and is similar to that of Nate Silver's district-level analysis on the FiveThirtyEight blog in the New York Times:
http://fivethirtyeight.blogs.nytimes.com/2010/11/08/2010-an-aligning-election/
Data was collected from MSNBC.com on November 9th, 2010.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | data(houseRace10)
hr <- table(houseRace10[,c("abbr", "party1")])
nr <- apply(hr, 1, sum)
data(prRace08)
pr <- prRace08[prRace08$state != "DC",c("state", "pObama")]
hr <- hr[as.character(pr$state),]
(fit <- glm(hr ~ pr$pObama, family=binomial))
x1 <- pr$pObama[match(houseRace10$abbr, pr$state)]
y1 <- (houseRace10$party1 == "Democrat")+0
g <- glm(y1 ~ x1, family=binomial)
x <- pr$pObama[pr$state != "DC"]
nr <- apply(hr, 1, sum)
plot(x, hr[,"Democrat"] / nr,
pch = 19, cex = sqrt(nr), col = "#22558844",
xlim = c(20, 80), ylim = c(0, 1),
xlab = "Percent vote for Obama in 2008",
ylab = "Probability of Democrat winning House seat")
X <- seq(0, 100, 0.1)
lo <- -5.6079 + 0.1009*X
p <- exp(lo)/(1+exp(lo))
lines(X, p)
abline(h=0:1, lty=2, col="#888888")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.