You Voted for Whom? My R Shiny App on the Demographics of Party Misalignment in the 2016 Election.
In this post I introduce my first interactive R Shiny app investigating demographic differences in the 2016 general election results.
Given concurrent Congressional and Presidential races in the 2016 election, I can segment out census demographics features among congressional districts that had winners from the same political party and those with winners from opposing parties.
Demonstrated R Skills:
- github/api data extraction
- R Shiny interactivity and googlevis visualizations
- ggplot mapping and seaborn visualization
See my code on github here.
Theory: Party Misalignment - National vs. Local levels
Political parties are amorphous and during a Presidential election, varies ideologies compete in primaries to represent each party in the general election. While the parties then unify around the primary winner, that candidate will not substantially represent a portion of their party's supporters.
Sometimes that discrepancy between voters' ideal candidates and the party's choice of candidate is so large that they are persuaded to vote instead for the opposing party's chosen candidate and are thus disloyal to their identified party.
The 2016 Presidential election delivered highly oppositional races within both the Republican and Democratic primaries and the general election. Virtually no one saw Donald Trump's hostile takeover of the Republican Party or believed Hilary Clinton would face a tough primary against Bernie Sanders. Therefore many voters who felt loyal to their local party's Congressional candidate felt 'misaligned' to their party's Presidential candidate.
Majority Vote winners in Congressional and Presidential elections in each Congressional District:
This party misalignment occurred in 35 of the country's 435 districts, and the party of the majority winning presidential candidate differed from the party of the elected Congressional representative.
Of these 35 districts, 23 majority voted in favor of both a Republican Congressperson and Hilary Clinton, and 12 voted in favor of both a Democratic Congressperson and Donald Trump.
Demographic Analysis - Overview
Ideological beliefs are highly related to demographic traits.
Thus, the second part of this analysis utilizes the U.S. Census Bureau's 2016 American Community Survey (ASC) to break down party misalignment along 3 demographic variables.
- Household Income
The ACS data displays the % of the population of each district at the each level of the variables included.
For each variables, I provide a visualization of the mean and variance breakdown across party misidentification. To experience the full interactivity of the graphics, check out my R Shiny app.
Data used for this analysis comes from three sources:
- MIT Election Lab dataset on Congressional election results
- DailyKos dataset on 2008, 2012, & 2016 Presidential election results
- CensusAPI via Hrecht on from Github
Demographic Analysis - Income
Mean breakdown of household income brackets across party identification.
Distribution of mean household income:
- Clinton Democrat districts are on average wealthier and have a higher variance than Trump Republican districts.
- Clinton Republican districts tend to be among the wealthiest.
- Districts with the lowest mean incomes appear the most polarized in their Presidential voting margins.
Demographic Analysis - Education
Mean breakdown of education level across all districts in voting group:
Distribution for each education level (interactive choice in R shiny):
- Clinton Democrat districts have on average both more highly educated and more non-educated populations than Trump Republican districts.
- Trump Democrat districts resemble Trump Republican districts in having majority populations with high school degrees.
- Clinton Republican districts are on average the most highly educated.
Demographic Analysis - Race/Ethnicity
Mean breakdown of racial/ethnic identification for each factor of party alignment.
Distribution for each racial/ethnic group (interactive choice in R shiny) :
- Trump Republican districts are on average significantly more white than Clinton Democrat districts.
- Trump Democrat districts are the most white on average, and greatly resemble Trump Republican districts.
- Clinton Republican districts have the highest means of latino-identifying members, resembling Clinton Democrat districts. They are otherwise differ from Clinton Democrat districts in being more white and less black-identifying.
Certain demographic differences stand out across district alignment.
Clinton Republican districts mirror the more affluent Clinton Democrat districts in being:
- higher income
- higher educated
- higher (especially Latino) non-white population
Trump Democrat districts mirror the average Trump Republican districts in being:
- lower/middle income
- lower/middle educated
- very high white population
The misaligned districts' demographics 'lost' their party's primary. Based on these results, one can imagine a very different result had the Republican candidate been Marco Rubio and the Democrat been Bernie Sanders.
While Trump's forceful ideology was not expected in 2016, he now holds significant sway over the Republican party looking toward to the upcoming 2018 Congressional midterm election. These 'misaligned' districts will be easy targets for Congressional candidates of the opposing parties. Whether or not these candidates are successful will indicate just how successful the extent to which the national party schema has been 'Trumpified'.
Build upon theory on Misalignment
- Evaluate quantitatively whether districts who had greater support for candidates who lost in the primaries were more likely to be mis-aligned in the general election.
- Further analysis to include not just districts with opposite party winners, but that also switch sides entirely during the election
Analyze over time relationship between demographic variables and political outcomes
- Instead of examining demographic breakdown only in 2016 election, look backward to compare Party results in Congressional/Demograhic changes in 2016
- Use inferential analysis to see if changes in party alignment during the unexpected 2016 election were statistically significant relative to past years