A historical look at presidential elections and an exploration into Donald Trump's tweets
This final project uses several different resources to examine past presidential elections and President-elect Donald Trump's use of Twitter. In addition to programs like R and R Studio, this project also utilizes SPSS and Google Sheets. Most of the visuals were designed using Google Sheets in order to make this page as interactive as possible for those reading it.
Putting U.S. and N.C. in Historical Context for Presidential Election Years:
To begin this project, I looked at historical data in North Carolina for presidential election years. I wanted to see how Trump's performance in 2016 compared to past N.C. winners. Using the North Carolina State Board of Elections website and David Leip's Atlas of U.S. Presidential Elections, I learned that no Republican has won the presidency without North Carolina since Dwight Eisenhower in 1956. In the end, Trump won the state by 173,000 votes, more than 3.6 percent of votes cast in the race.
Third Party Viability:
This project doesn't just look at the major political parties, though. It also examines the strength and viability of third party candidates in the last 10 presidential elections. Ross Perot proved to be a formidable third party candidate in 1992 and 1996, securing 18.9% and 8.4% of the popular vote, respectively. Libertarian Gary Johnson secured 3.28% of the popular vote this year. His total unofficial vote count (4,482,365) is nearly twice as much as the past three leading third party candidates combined. Though Perot and Johnson performed fairly well as third party candidates, neither of them earned a single electoral vote. Based on the data analyzed, it appears a serious third party contender is unlikely to win in the near future.
In conducting research on Trump's tweets, I came across a terrific article from David Robinson. The article, which is available here, uses R to analyze Trump's messaging by device. Robinson's analysis concludes that iPhone tweets are more positive and likely do not come from Trump. Tweets composed from an Android device are angrier, more negative and likely do come from Trump. Robinson did his analysis to fact check a tweet someone had written that had gone viral. Robinson ultimately proved that the person's tweet was correct. The original tweet is here.
Because I wanted my final project to be unique and something that had not already been done before, I decided to make Trump's use of Twitter a relatively small part of my project and focus more on third party viability and historical trends in presidential election years.
Using data from U.S. Election Atlas and NCSBE, I examined trends within the last 10 presidential elections both in North Carolina and in the United States. The process of gathering data and presenting it are highlighted below:
Step 2: Transfer data to Google Sheets.
Step 3: Design an interactive scatter plot for major party candidates and compare the differences between Democrats and Republicans.
Step 4: Analyze results.
North Carolina Popular Vote
National Popular Vote
North Carolina has been fairly consistent with the outcomes of the general election. Democrats won the presidency in 1992, 1996, 2008, and 2012. North Carolina, however, only went for the Democratic Party in 2008 when Barack Obama defeated John McCain by 0.32%. In the last 10 elections, the winner of North Carolina has gone on to win the presidency seven times. Despite Obama's 2008 victory, Republicans continue to hold a slight edge in the state.
While North Carolina has traditionally leaned Republican in the last several decades, races have been mostly competitive since 1980. Four of the last ten presidential elections in North Carolina have been decided by less than 2.5%. Historical data reflects how North Carolina has become a major battleground state — a title the state will likely retain in 2020.
For the most part, third parties have had a very limited influence in both North Carolina and the United States. In North Carolina, the popular vote gap between third parties and the main parties is extraordinary. In the last five presidential elections, third party candidates have had virtually zero impact.
Since 1980, there have only been three third party candidates who have had a presence and have generated a following: Ross Perot (1992, 1996), Ralph Nader (2000), and Gary Johnson (2016).
Perot's 1992 campaign is the most noteworthy of the examples highlighted above. In 1992, Perot captured 18.91% of the national vote. He ran as an Independent and likely diminished Republican George H.W. Bush's chances at winning reelection. Democrat Bill Clinton ousted Bush by a sizable 5.56%. Perot ran again in 1996, capturing 8.4% of the national popular vote. No other candidate has come remotely close to double digits since Perot.
Green Party candidate Ralph Nader developed a reputation as a "spoiler" because of the highly contested race between Republican George W. Bush and Democrat Al Gore. Though Gore won the national popular vote, Bush became president by winning Florida to narrowly claim the Electoral College. After 5,963,110 votes were counted, Bush defeated Gore by just 537 total votes — a difference of less than 0.01%. Nader had a total of 97,488 votes in Florida. He or any other third party candidate could have easily tilted the election in Gore's favor. At a macro level, Nader had less than 3% of the national popular vote. But in a highly contested race, Nader proved that a third party candidate could have an impact.
Libertarian Gary Johnson tried to appeal to voters dissatisfied with their options of Republican Donald Trump and Democrat Hillary Clinton. Despite poll numbers in the high single digits during the summer of 2016, he only 3.28% of the national popular vote. Johnson appealed fairly evenly to both Democrats and Republicans and did not appear to "take votes away" from either major party. In an article from FiveThirtyEight, he had lowered Clinton's margin of victory by 1%. Since the article was published in July 2016 and Johnson's poll numbers decreased substantially in the weeks leading up to the general election, his influence was very limited and did not have much impact on the outcome. If people who voted for Johnson completely flipped their vote to Clinton, Clinton could have won key swing states and defeated Trump. Still, the scenario is highly unlikely and merely speculative.
The chart below outlines the limited influence of third party candidates by showing results from the last 10 presidential elections in North Carolina. It compares the highest polling candidate who wasn't a Democrat or Republican with all the other third party candidates combined. In other words, the third place finisher is compared with all the other finishers when their numbers are added together.
Step 2: Transfer data to Google Sheets.
Step 3: Design an interactive line graph for major party candidates and compare the differences between the leading third party candidate and all other non-majority party candidates.
Step 4: Analyze results.
Besides Ross Perot in 1992, no third party candidate has polled above 10% in the past 10 presidential races. It is also worth noting that no third party candidate has earned an electoral vote or won a single state in the last 10 elections.
On April 12, 2016, Donald Trump and his family sat down with CNN's Anderson Cooper. In one part of the interview, Trump was asked about his use of Twitter. The video clip is only 40 seconds, but it reveals much from Trump's perspective on how he manages his Twitter account.
Notable Trump Quotes in Video:
Fact Checking Trump's Claims:
Step 1: Use Twitonomy and download latest 3,200 tweets from @realDonaldTrump. Dates range from February 25, 2016 to December 11, 2016.
Step 2: Export file as a .csv and import dataset into R Studio.
Step 3: Load file into Excel and glance at tweets by time of day. Copy and paste link into Google Chrome to make sure time codes are synched up properly.
Step 4: Code in R and make a graphic displaying the different platforms Trump has used.
trump_tweets_df <- TrumpTweets
ggplot(trump_tweets_df, aes(Platform)) + geom_bar(aes(fill=..count..))
Step 5: Look at distribution of tweets across different platforms.
Step 6: Go into Excel and do informal canvassing of tweets to check for any patterns.
Step 7: Convert R histogram to pie chart in Google Sheets and convert as percentage to see platform broken down more specifically.
Step 8: Analyze results.
Note: The bar chart above has a blank space to represent tweets where platforms were not shown in R. This portion of the chart represents the number of tweets where no platform was stated.
Claim #1: Nearly 40% of Trump's tweets were sent out after 7 p.m. Eastern Standard Time. Because Trump campaigned throughout the country, the timestamp might not be reflective of the volume of tweets at different points in the day. Nevertheless, based on Trump's statement that he alone tweets after 7 p.m., it would appear a sizable portion of his tweets came exclusively from himself.
Claim #2: The available data from the API only shows the platform of the tweet. It would be impossible to identify every person who physically tweeted every individual tweet. Moreover, this claim could not be refuted or affirmed. Still, Trump's claim that he always tweets after 7 p.m., proved to be incorrect. Tweets composed after 7 p.m. came from a combination of platforms, mostly iPhone and Android. It appears Trump tweets from his Android and others tweet from an iPhone after 7 p.m. An informal canvassing of Trump's tweets suggests that a sizable majority of Trump's tweets after 7 p.m. were from his Android. Nevertheless, it is incorrect to say that all of the tweets posted after 7 p.m. were made exclusively by Trump.
For my Public Opinion Polling class, I looked at the Pew Research Center's October 2014 Political Survey. A downloadable dataset is available here.
One question asked how much people had thought about the upcoming 2014 election. Though this survey is not necessarily applicable to this project because it was not conducted during a presidential election year, I found it worth sharing how much variation there was by age.
Step 1: Download dataset and import it into SPSS.
Step 2: Using the codebook provided by the Pew Research Center, examine which questions are most interesting.
Step 3: Locate corresponding variable names in SPSS.
Step 4: Recode age by generation. In this example, I changed those who were 18-33 years old into a Millennial category. Those who were 34-49 were Gen Xers, 50-68 were Baby Boomers, and those who were 69 or older were classified as members of the Greatest or Silent generation. All other values were put into an Other/Missing group — this mostly included people who were not willing to provide their age.
Step 5: Once variables have been recoded, make a two-way crosstab. For this visual, THOUGHT and agrecode were the two variables. This chart identified the amount of thought respondents had given to the 2014 election by generation.
Step 6: Analyze SPSS chart.
Step 7: Make an interactive graphic through Google Sheets.
Results show significant differences in level of thought about the election by generation. The graphic reveals that just 26.7% say they have thought about the election quite a lot. In contrast, 49.1% of Gen Xers, 63.1% of Baby Boomers, and 68.9% of those in the Silent/Greatest generation say the same. While this survey was not conducted in a presidential year, it appears to carry broader implications about the levels of political engagement by age. Younger people likely did not think about the 2016 presidential election as much as older generations, but it is safe to assume all generations gave more thought to the 2016 election than the 2014 election.
Thank you for reading this project. It encompassed a wide range of topics. From placing the 2016 election into a broader state and national historical context to exploring the impact, or lack thereof, of third party candidates to critically examining Donald Trump's tweets, it is my hope that there was something in here for everybody. I gladly welcome feedback and questions, and I can be emailed at email@example.com.