Election results for the 2010 U.S. House of Represenatives races
Source:R/data-houserace10.R
houserace10.Rd
Election results for the 2010 U.S. House of Represenatives races
Format
A data frame with 435 observations on the following 24 variables.
- id
Unique identifier for the race, which does not overlap with other 2010 races (see
govrace10
andsenaterace10
)- state
State name
- abbr
State name abbreviation
- num
District number for the state
- name1
Name of the winning candidate
- perc1
Percentage of vote for winning candidate (if more than one candidate)
- party1
Party of winning candidate
- votes1
Number of votes for winning candidate
- name2
Name of candidate with second most votes
- perc2
Percentage of vote for candidate who came in second
- party2
Party of candidate with second most votes
- votes2
Number of votes for candidate who came in second
- name3
Name of candidate with third most votes
- perc3
Percentage of vote for candidate who came in third
- party3
Party of candidate with third most votes
- votes3
Number of votes for candidate who came in third
- name4
Name of candidate with fourth most votes
- perc4
Percentage of vote for candidate who came in fourth
- party4
Party of candidate with fourth most votes
- votes4
Number of votes for candidate who came in fourth
- name5
Name of candidate with fifth most votes
- perc5
Percentage of vote for candidate who came in fifth
- party5
Party of candidate with fifth most votes
- votes5
Number of votes for candidate who came in fifth
Details
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: https://fivethirtyeight.com/features/2010-an-aligning-election/
Examples
hr <- table(houserace10[, c("abbr", "party1")])
nr <- apply(hr, 1, sum)
pr <- prrace08[prrace08$state != "DC", c("state", "p_obama")]
hr <- hr[as.character(pr$state), ]
(fit <- glm(hr ~ pr$p_obama, family = binomial))
#>
#> Call: glm(formula = hr ~ pr$p_obama, family = binomial)
#>
#> Coefficients:
#> (Intercept) pr$p_obama
#> -5.726 0.103
#>
#> Degrees of Freedom: 49 Total (i.e. Null); 48 Residual
#> Null Deviance: 107.4
#> Residual Deviance: 48.72 AIC: 138.7
x1 <- pr$p_obama[match(houserace10$abbr, pr$state)]
y1 <- (houserace10$party1 == "Democrat") + 0
g <- glm(y1 ~ x1, family = binomial)
x <- pr$p_obama[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")