Why are we letting Trump’s tweet affect our mood?

If you tend to follow Trump on Twitter, then your reaction to his tweets might be influenced by his tone. The overall opinion divided by two sharply contrasting groups normally follow the tone of original tweet.

Shreyas Jothish
Towards Data Science

--

Prologue

Based on my previous analysis on Twitter’s social influence, tweets from Donald J. Trump (@realDonaldTrump), The President of the United States has relatively higher engagement.

I wanted to know to what extent the sentiment of the people’s response is influenced by original tweet from the Mr. Trump.

Insight on Data

To start with, I fetched the data from Twitter using Tweepy. I designed my experiment to fetch the recent 200 tweets with Twitter handle @realDonaldTrump and up to 100 related tweets from others for each Trump tweet.

Sentiment analysis was done to determine tweet’s polarity using TextBlob for each tweet retrieved.

Initial Observation

Plotting of Trump’s tweet polarity and average of corresponding responses from people revealed overlap. However, Trump’s tweet polarity has wider spread.

This could be resulting from the fact that people’s tweet polarity averages out as compared to polarity of single Trump tweet.

So I scaled down the Trump tweets polarity to 70%. But the result is still non conclusive.

Next logical step was to dig deeper into individual set of Trump tweet and its corresponding responses from others.

Distribution of responses from people for positively polarized Trump tweet and negatively polarized Trump tweet appears similar. Though result is still non conclusive, I found one interesting pattern emerging.

Positively polarized Trump tweet gets more positively polarized responses from others as compared to negatively polarized responses. Similarly, Negatively polarized Trump tweet gets more negatively polarized response from others as compared to positively polarized responses.

Tweet timeline analysis

I wanted to determine this new found pattern of people’s responses following Trump’s tweet sentiment is recurrent.

The transition of average polarity of people responses does seem to follow abrupt polarity switching of Trump’s tweet. Sometimes within minutes.

Timeline plot of individual tweet sets has lot of spikes and mostly appears noisy to naked eyes. For better visualization, I have aggregated sum of tweet polarity by day.

Conclusion

From the above analysis it does appear the people’s response to Trump tweets follows the tone of original tweet to great extent.

This analysis is based on fetching Trump’s Twitter data over recent weeks and do to consider the limitation of APIs used. TextBlob does not consider sarcasm of the text being analyzed or Twitter having restrictions on the number of records that can be fetched with Standard search API.

Source Code:

https://github.com/ShreyasJothish/tweetsentimenttimeline

References:

--

--