Saturday, August 13, 2016

How to Tell if a Tweet Was Actually Written by Trump

I discovered a new blog today and read a great article involving text analysis of Trump's tweets. The blog, Variance Explained, is written by David Robinson, a data scientist at Stack Overflow. He saw a tweet stating a hypothesis:
When Trump wishes the Olympic team good luck, he’s tweeting from his iPhone. When he’s insulting a rival, he’s usually tweeting from an Android. Is this an artifact showing which tweets are Trump’s own and which are by some handler?
So he decided to test this hypothesis using text analysis. He does this with a few R packages, including twitteR and tidytext (which he created with Julia Silge - it can assign words to 10 sentiments: positive, negative, anger, anticipation, disgust, fear, joy, sadness, surprise, and trust). And by the way, he gives you all the code he used and shows you step by step how he did everything. I kind of love this guy.

So what did he find? First, tweets from the Android phone tended to occur in the morning while iPhone tweets tended to occur in afternoon/evening. iPhone tweets were more likely to include a picture or a link (38 times more likely, in fact), or hashtags. Text analysis showed differences in the words used:


And sentiment analysis quantified these differences:
Thus, Trump’s Android account uses about 40-80% more words related to disgust, sadness, fear, anger, and other “negative” sentiments than the iPhone account does. (The positive emotions weren’t different to a statistically significant extent).
So now you know who's doing the talking in Trump's tweets.

No comments:

Post a Comment