R for Political Data Science Week 10: What If Each State Allocated Their Electoral College Votes Proportionally?

On Mar. 08, 2019  in R for Political DataUS PoliticsR-Posts

This is part of a series of short posts about politics that seeks to show how we use data science to learn more about the real world. Follow along here.

Since Donald Trump’s victory in the 2016 election — when he lost the popular vote but won the Electoral College — there has been a large movement to reform the system that elects the President of the United States. Under the current rules, each state (except Nebraska and Maine) gives all of its electoral votes to the winner of the statewide popular vote. Perhaps the more controversial provision is that each state’s number of voters in the Electoral College is determined by the sum of their Representatives and Senators in the U.S. Congress, which inflates the power of smaller, less populous states. I’m not going to talk about this today; Instead, I’m going to talk about how presidential elections would be different if each state’s vote allocation rules changed.

Three things would happen if states allocated their Electoral College votes proportionally instead of on a winner-takes-all system (that is, if a presidential candidate wins 55% of the popular vote in a state, the win 55% of its Electoral College votes instead of 100%). First, the outcome of presidential elections would look much less lopsided. That’s because a candidate that loses many states by small margins would earn many more votes than they do now. This is the case in 1980 when Jimmy Carter lost 135 electoral votes in states where Ronald Reagan beat him by a measly 5 percentage points or less. Total, Ronald Reagan ended up winning 489 electoral votes that year — that’s 90% of all Electoral College votes for a vote share of just… 51%.

Second, by virtue of proportional allocation, the undue influence given to smaller states would shrink. That’s because the misrepresentation isn’t being exacerbated by delivering all of, e.g., Wyoming’s three electoral votes to the same candidate. In close elections, this matters a lot.

The third major effect, as you may be able to infer from the previous point, is that Hillary Clinton would have won the 2016 election. This is not just because she picks up votes in Florida, North Carolina and the rust belt defectors, but also a sizable number in Texas and elsewhere in Middle America.

I’ve done the math for both allocation systems — proportional and winner-takes-all — in each presidential election since 1976 (reveal the code to see how I’ve done this) and totaled up the Democratic Electoral College votes in the figures below:

library(tidyverse)
library(politicaldata)

# get historical presidential election results
pres_history <- politicaldata::pres_results

# combine with the number of ec votesfor that state that year (here: https://raw.githubusercontent.com/brandly/presidential-election-data/master/json/<YEAR>.json)
library(jsonlite)

# a function for turning the json intot a data.frame
get_state_year_evs <- function(year){
# if 2016, get the data for 2012 (it's the same, but not in the github file)
year_str = ifelse(year==2016,2012,year)

# grab the json
results = fromJSON(url(sprintf('https://raw.githubusercontent.com/brandly/presidential-election-data/master/json/%s.json',year_str)))

votes <- results$votes # for every state, return its name and number of total votes ec_data <- lapply(1:length(votes), function(i){ state_abb <- names(votes)[i] state_data <- votes[[i]] ec <- state_data$electoral$republican + state_data$electoral$democrat return(data.frame(state_abb,ec,stringsAsFactors = F)) } ) %>% do.call('rbind',.) # return the data return(ec_data %>% mutate(year = year)) } # get evs for each year in pres_history (exccept 2016) votes_by_year <- lapply(unique(pres_history$year),
function(x){
return(get_state_year_evs(x))
}) %>%
do.call('bind_rows',.)

# bind to the results data
pres_ev <- pres_history %>%

# now, for each year, calculate the winner-takes-all EC vote winner and the proportional EC vote winner
pres_ev <- pres_ev %>%
mutate(other = ifelse(is.na(other),0,other)) %>% # first make sure the other = 0 is NA, else comparisons don't work
mutate(dem_wta = case_when(dem > rep & dem > other ~ as.numeric(ec),
TRUE ~ 0 ),
rep_wta = case_when(rep > dem & rep > other ~ as.numeric(ec),
TRUE ~ 0 ),
other_wta = case_when(other > dem & other > rep ~ as.numeric(ec),
TRUE ~ 0),
dem_prop = round(ec*(dem/(dem+rep))),
rep_prop = round(ec*(rep/(dem+rep))))

# now total the Dem electoral votes by type by year
prop_v_wta <- pres_ev %>%
group_by(year) %>%
summarise(dem_wta = sum(dem_wta),
rep_wta = sum(rep_wta),
dem_prop = sum(dem_prop),
rep_prop = sum(rep_prop))

# graphing ------------
# graph the proportional allocation chart
prop.gg <- ggplot(prop_v_wta, aes(x=year,y=dem_prop-270)) +
geom_hline(yintercept = 0,linetype=2,col='gray60') +
geom_bar(stat="identity",aes(col=dem_prop>=270,fill=dem_prop>=270)) +
geom_label(aes(label=paste("D:",dem_prop),
y = ifelse(dem_prop>=270,
(dem_prop-270)+4,
(dem_prop-270)-4),
col=dem_prop>=270)) +
scale_x_continuous(breaks=seq(1900,2016,4)) +
scale_y_continuous(labels=function(x)return(x+270),
limits=c(-538+270,538-270),
breaks=c(0,135,270,404,538)-270) +
scale_color_manual(values=c("TRUE"="#3498DB","FALSE"="#E74C3C")) +
scale_fill_manual(values=c("TRUE"="#3498DB","FALSE"="#E74C3C")) +
labs(title="Electoral College Results Under Proportional Allocation*",
subtitle="Under a system of proportional allocation, landslides don't happen because slim victories\nresult in nearly equal Electoral College vote allocation (and Hillary Clinton would have won in 2016)",
x="Year",

# graph the WTA chart
wta.gg <- ggplot(prop_v_wta, aes(x=year,y=dem_wta-270)) +
geom_hline(yintercept = 0,linetype=2,col='gray60') +
geom_bar(stat="identity",aes(col=dem_wta>=270,fill=dem_wta>=270)) +
geom_label(aes(label=paste("D:",dem_wta),
y = ifelse(dem_wta>=270,
(dem_wta-270)+4,
(dem_wta-270)-4),
col=dem_wta>=270)) +
scale_x_continuous(breaks=seq(1900,2016,4)) +
scale_y_continuous(labels=function(x)return(x+270),
limits=c(-538+270,538-270),
breaks=c(0,135,270,404,538)-270) +
scale_color_manual(values=c("TRUE"="#3498DB","FALSE"="#E74C3C")) +
scale_fill_manual(values=c("TRUE"="#3498DB","FALSE"="#E74C3C")) +
labs(title="Electoral College Results Under Winner-Takes-All*",
subtitle="Under the current rules, a candidate gets all of a state's Electoral College\nvotes so long as they have the largest statewide popular vote percentage (except in NE and ME).\nThis inflates wins/losses",
x="Year",
caption="*When ME and NE don't split votes by congressional district")

# plot them
preview(wta.gg)

preview(prop.gg)

I’ve given the y-axis on these two figures the same constraints to drive home the primary impact of a shift to proportional allocation (saying “good riddance” to electoral landslides). You can also see how proportional allocation would have given Hillary Clinton a razor-thin margin of victory in 2016 — she has just enough electoral college votes to avoid a tie.

We can think of the political science consequences of such a shift. First, it wouldn’t be so evident that presidents earn “mandates” from their elections (though, to be quite honest, I think the idea that presidents get mandates is somewhat of a misleading notion anyways); each election since 1992 would have been decided by fewer than 20 EVs. The nature of campaigns might also change, as candidates will have to battle for voters not just in the swing states of Ohio, Florida, North Carolina and Iowa but also in deep-blue California and crimson-red Texas, in the Republican-loyal Deep South and liberal Northeast.

Not to mention that the entire Electoral College system would probably just… break. With proportional delegate allocation, third parties would be able to scrape up at least some support in the final reflection of the voters’ will. If a single candidate third-party candidate could muster the support of, say, 20% of the vote in each state, it’d be nearly impossible for either major party candidate to pass the 270-EV threshold for winning the election. The elections in 1980, 1992, 2000 and 2016, would likely have been thrown to the House of Representatives. That could have set off a constitutional crisis the likes of which we have not seen since the Civil War (though may be approaching now for other reasons). _This, by the way, is also why I’ve performed all the calculations here among the two-party popular vote. The whole exercise is almost made moot by allowing third-party candidates to also win Electoral College votes in a system of proportional allocation. Nobody except Ronald Reagan (in 1984) and Obama (in 2008) ever win.

I hope this has been an enlightening exercise. Per usual, the reason I’m doing this is largely to show the code. So click the ‘Show Code’ button above if you’re trying to learn more.