First term Presidential Referendum through Congressional Midterm Elections: Shiny App Analysis

Johnna Ayres
Posted on Feb 6, 2017

Slide1
Introduction

“Midterm elections are regarded as a referendum on the sitting president's and/or incumbent party's performance.” (source: Wikipedia, “United States midterm elections”, https://en.wikipedia.org/wiki/United_States_midterm_election)

Utilizing data visualization through a Shiny app, this analysis reviews the composition of the US congress (Senate and House of Representatives) in the first year of a presidential term and two years after the presidential election at the midterm elections.  The analysis includes the congressional composition and seat changes over time by state and by party represented in a plot encompassing the United States as a whole. Each house of congress is segmented in its own plot.

The analysis also visually summarizes the change in congressional seats by party at the midterm elections thereby indicating whether a president has gained or lost party strength in the congress - either in the senate, house or both.

The gain or loss in congressional party seats is the referendum on the sitting president. The midterm elections indicate how well the president is doing his job. Any changes in party strength based on congressional seat changes has a profound impact on the power and ability of a president’s performance. The ramifications are widespread affecting every American and the world too.

Data Description

The data set utilized for this analysis was the Kaggle “Party Strength by State” data set available at https://www.kaggle.com/kiwiphrases/partystrengthbystate. The data set begins with President Ronald Reagan’s first term in 1980 moving through present day.

The data set also includes state level gubernatorial and state legislature data. This information was not utilized for the sake of this particular data visualization analysis.

Independents were also included in the data set. However, the observations of independents were insignificant and were disregarded with the primary focus of the analysis on the two main political parties in the United States: Republicans and Democrats.

Data Visualization 

The data visualization from the Shiny app shows two primary graphical renderings by congressional house. The first group of renderings illustrates a map of the US showcasing the composition of the congress during presidential and midterm elections. Utilizing the primary widget, the date of the data corresponding to a specific president of interest may be changed using the drop-down menu.

With Reagan’s first term as the start of the data set, the second graphical rendering to the right of each US map shows the changes in congressional seat by party. To render this graph, click the second widget “Select Congressional Mid Term Election” to highlight seat changes by party at the midterms.

Please note: the coloring of these plots is consistent with other political plots: red represents the Republican party; blue represents the Democrat party; and white represents an even split between the two parties where senators or representatives are 50/50 in their party affiliation by state. The white representation is much more prevalent in the Senate than the House of Representatives due to the smaller sample size by state, e.g. two senators to numerous representatives by state population.

Following is the data visualization of the Reagan-era midterm election results:

Slide3

Shiny App Summarized Analysis

Analyzing the data through Shiny app visualizations over time, President Ronald Reagan, the only president since 1980, gained strength in his party after being in the White House for the first two years of his first term. Given his positive midterm referendum, the change in party seats from democrat to republican indicates that the electorate felt comfortable with Reagan’s leadership providing more voting seats within his party in congress. To this day, history looks back upon President Ronald Reagan as one of the greatest presidents of the 20th century.

Reagan was the last president to enjoy such a positive midterm referendum in his first term. Since Reagan, all other presidents have consistently lost seats in the midterms, thus losing power and finding increasing difficulty in working with congress to legislate for the electorate.

A further summary analysis derived through the Shiny app by president and party strength (+/- congressional seats at the midterms) can be visualized at this URL: http://216.230.228.88:3838/bootcamp008_project/Project1-ExploreVis/johnna_ayres_shiny_app/

Charted Analysis using the Shiny App

The following chart summarizes the data visualized in the Shinny app by president and election.

Slide4D = Democrats; R = Republicans; Independents were excluded from this analysis given insignificant observations.

Conclusion 

Based on the data visualized in the Shiny app and summarized in the chart above, there are two key-takeaways:

  • As indicated previously, in his first term as president, President Ronald Reagan gained seats at the midterm elections (positive referendum) furthering his republican base and support in congress. He gained seats in both the Senate and House of Representatives thereby supporting his initiatives as president.
  • Since Reagan, no other president has seen such strong partisan support. Consistently, other presidents have seen a loss in congressional seats in one house of congress or both furthering the erosion in their party base. Two potential factors help explain this phenomena.

One, fewer voters take a stance at the midterms, whereas in main stream presidential elections there is greater voter turn-out. Essentially, the midterms are biased as the ‘motivated voter’ turns up to vote whereas others do not.  

Second, historically, presidents lose ground with voters once they begin making policy. Simply put, a president cannot support all of those campaign promises and the electorate lets him know by culling his power through congressional party seat changes at the midterms.

Project Iterations

Any data visualization analysis requires iteration to fully tell the story of ‘why'. In this case, there are several data points that may be added to this analysis to make the data more robust and to take the analytical conclusions to another level. Those data iterations include:

  • Economic Data: Many voters are likely to ‘vote with their wallet.’ Given this trend, adding jobs data and consumer sentiment during each presidential term would help illustrate ‘why’ a president gained or lost seats during the midterms. Other potential data to consider: crude oil and gas price data, tracking recessions, US GDP and spending on wars to fight terrorism (Iraq I, Iraq II and Afghanistan). All of these data points directly impact US tax payers and influence the sentiment of the electorate.
  • Voter Demographic Data: Include the difference between presidential and midterm voter demographics and voter turn-out.
  • Regression Analysis: Projection of President Trump’s midterm congressional elections using an improved data set and multivariate regression analysis.

R Code

The following code represents the R code derived to create multiple data frames calculating the difference in congressional seats - core to this analysis. Other R code was utilized through the ui and server files to plot the geographical maps based on the primary data set.

Calculating the congressional seat differences required the creation and mutation of multiple data frames. Once created, the difference between the data frames was calculated and new integers were stored for analysis and graphical use. As a result, new visualizations of the congressional seat changes by presidential midterm election were charted and rendered using googleVis and the Shiny app.

The baseline code for these graphical renderings follows:


Slide2

 

About Author

Related Articles

Leave a Comment

Your email address will not be published. Required fields are marked *

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags