Analyzing Trump’s Twitter Compulsion
By: Jennifer Mckaig
Tags: Towards Data Science, Twitter, Data Science, Politics, Data

IMAGE VIA SCREENGRAB

Never before has a U.S. President used Twitter to such a prolific and disturbing degree. What hidden insights can we glean from the text messages of a president who many believe to be mentally unraveling?

I copied Trump’s tweet data from the Trump Twitter Archive, opting to analyze the tweets starting on Jan. 20, 2017 at the top of his Presidential term. After saving the text data as a csv file, I imported the file into a Jupyter Notebook using the Pandas library.

As a data science student at the Flatiron School, I have been studying statistical distributions and probability. The Poisson Distribution is interesting because it allows us to calculate the probability of a given event happening by examining the average number of events that happen in a specific time frame.

image from Slideplayer.com

Using the information from Twitter, I want to determine the probability that Trump will compose a tweet at least 2 times in the next hour. This seems simple enough, but in order to make this calculation, I need to determine the frequency of his tweets in a certain time period.

I looked to the data for answers, believing that there must be a pattern to his daily Twitter usage. Surely, a President’s busy schedule will limit his smartphone communications at certain times of the day or night.

Alas, it appears there is no hour of the day that remains tweet-free, although Trump rarely tweets between 5 am and 10 am. His public schedule places Trump in the Oval office from around 8 am until 11 am on a typical day, so we can see that he has most likely tweeted upwards of 800 times while potentially making important executive decisions that impact the lives of millions of people across the world.

I cannot tell whether the tweets are actually coming from Trump himself or whether they are sent by his staff. Some of his tweets must have been made while he has traveled abroad or across the U.S., but the archived Twitter data only gives us the Eastern Standard timestamp.

Factbase has created a detailed calendar which aggregates information from multiple public sources and provides location and meeting data. They have determined that 705 of Trump’s 879 days in office have been spent at the Whitehouse, which means that ~80% of these tweets times are accurate.

Perhaps his tweet frequency by the day of the week will give us better insight. Internet and app usage have shown predictable traffic and behavioral patterns. According to Sprout Social, the best days to post on Twitter are Tuesdays and Wednesdays. Mondays through Fridays from 8 a.m.–4 p.m. also offer steady traffic and on Saturdays twitter engagement drops.

Below is a graph of Trump’s tweet frequency per day of the week. On average, Wednesdays and Fridays have been his busiest days. Could this be related to the news cycle or peak Twitter traffic times? Or is tweeting predominantly an impulsive activity and if so, what more important work is it interrupting?

Looking at the average tweets per day, Trump’s tweeting frequencies have increased year over year. While it is not a complete year over year comparison because we are less than halfway through 2019 — his average tweet rate per day has nearly doubled on the weekends.

So, how likely is it that Trump will tweet twice within the next hour? Given that it is currently a Tuesday in 2019, he is averaging around 12 tweets a day and he reports to only sleep about 5 hrs a day, the probability is pretty low — at 11%.

If time is not the best indicator of Trump’s need to tweet, what else could it be?

I downloaded a copy of Trump’s leaked private schedule from Axios and converted it into a csv file, I then merged the file with his tweet data. We can now see what Trump was supposed to be doing and where he was located while tweeting- November 7, 2018, through February 1, 2019. It looks like the majority (166 tweets) were sent while he was scheduled to be in the Oval Office.

There were 50 tweets with missing location data, but they were mostly made during the holidays. We know that Trump was at Mar a Lago for Thanksgiving and that he spent Christmas in Washington D.C. due to the government shutdown.

So what was on Trump’s schedule while he was tweeting from the Oval Office? Not surprisingly, it is largely categorized as Executive Time, but he was also tweeting during several meetings and lunches. Zooming out, we can look at all of the activity categories on Trump’s schedule, regardless of location, to find the tweet frequencies during each activity.

We are not given any additional information on Executive Time, but we can get additional details about his meetings and lunches. Below is a frequency graph of the activities categorized as a Meeting. It appears that he is most distracted by Twitter during Policy Discussions, Intelligence Briefings, and meetings with his Chief of Staff, essentially while conducting some of the most important aspects of his job.

Trump's lunch tweets are mostly made during private lunches, and the frequency declines when it is a working lunch.

As a Brooklyn resident, I am a bit surprised to see that he was eating and tweeting with NY Governor Andrew Cuomo. He tweeted 5 times during their November 28th lunch, four were retweets and one was this —

In conclusion, it was surprisingly easy to analyze Trump’s tweets. It is a silly exercise to predict whether he will tweet in a certain time frame but it inevitably revealed interesting information about his daily activities. While there have been several investigations into the content and impact of his tweets, we can also analyze the disruption and risk created by his habits.