The Limits of Automated Sentiment Analysis of Twitter

As part of my weekly analysis of the campaign race between Obama and Romney, I took a look at the sentiment of the tweets mentioning both of them.  That report will be up a bit later on today, but I wanted to share something interesting I’ve found while working on the report.

I did a manual sentiment analysis of the tweets to determine whether they are pro-candidate (or at least neutral) or anti-candidate.  The manual process consists of selecting a statistically valid sample at random and then reading each tweet to score it.  It’s slow, painstaking, but it produces the best results because I, as a human and one that is versed in current events, understand the text, the context, and can usually guess the writer’s intent.

But there are also automated tools for doing sentiment analysis, and I use these tools too.  These tools look at the text, do a simplistic parsing of the tweet, and assign a score based upon the words that are used: “Hate” gets a negative score while “Love” gets a positive score.  You might think that these tools are very crude, and you’d be right.  But that doesn’t mean they don’t deliver some useful insight.

Take, for example, last week’s (4/29-5/5/2012) tweets mentioning Obama.  Here’s how I scored them manually:

The margin of error is +/- 5% at a 95% confidence level (which is pretty much the gold standard for surveys).  How did the automated tool do:

Very close!  You’ll note there’s no “off topic” or “neutral” category in this chart.  That’s because a huge majority of tweets end up with a neutral score, and that’s really a failure of the scoring system rather than a real indication of indifference.  Still, both the 76% and 24% are within the margin of error of the manual survey, so we can say they produced the same results.  Fantastic! (Obama -Romney means I just looked at tweets that mentioned Obama but did not mention Romney — I didn’t want the score to be confused by negative-about-Romney tweets that mentioned Obama).

But does this always work? Let’s look at Romney’s sentiment as scored manually:

Mitt didn’t have that great of a Twitter week, although a lot of the negatives were other republicans not happy about losing Santorum and Newt, or people still supporting Ron Paul.  So a lot of the negatives are probably not supporters of Obama.

Let’s compare this to the automated sentiment analysis:

Quite different! Why? Mostly because although I tried to filter out posts that were really about Obama, there’s a lot of posts that snuck through without mentioning him.  #Julia and other anti-Obama hashtags were a common source.

The lesson here is that for automated tools you need to very carefully scrub the tweets being examined to make sure they are really on the topic you are interested in.  Or, put another way, because so many Romney supporters like to talk about how bad the President is instead of how great Romney is, it skews the automated analysis.

I’ll be trying to work in a better algorithm for analyzing sentiment, and I know others have made great strides in that direction as well.  But the key thing to remember is that automated sentiment analysis works best when the tweets are talking about the subject you’re interested in, and poorly when people mention your subject in passing while talking about something else.  When you see people give a score to a collection of tweets, you should generally assume that they are using automated tools rather than scoring them by hand.  And so you should keep in mind the limitations of those tools.

Is #Julia a debacle for Obama?

For a campaign with as strong a reputation as Team Obama has for social media, there’s been some gaffes lately.

You might recall a few weeks ago, we had the #DontDoubleMyRate hash tag.  That worked out OK, with most of the tweets being pro-Obama:

The conservatives tried to (and claimed to) hijack it, but the large number of tweets from college kids in favor of it overwhelmed the opponents.

So far so good.  But only so far…

Then, we have the #forward hashtag.  That didn’t do as well:

Only 25% of the tweets were on this topic.

Now comes the #julia hashtag. My oh my, there was hardly an Obama supporter to be seen:

It’s just not a positive conversation.

Is this a debacle for Obama — is his social media team losing its grip?

No, not really.  The #Julia tag is not an official tag of the campaign.  Rather, it’s a creation of conservatives who want to criticize the Obama campaign.  It’s not surprising that it’s overwhelmingly negative — it’s the invention of negative intentions.

Should pro-Obama supporters have jumped in to hijack the tag for Obama? That’s not for me to say, although I think hashtag pissing contents are at best juvenile.  So I guess I would say who cares…

The one thing this is not, though, is a debacle for Obama.  It’s a bunch of conservatives who like to hear themselves tweet…

Methodology:

I looked at the ~46000 tweets between 4/27 and 5/4 that mentioned #julia.  I took a random sample of 381 of them and scored them as either being conservative, liberal, or who knows.  From that sample, I estimate that 80% +/- 5% of all 46000 tweets were anti-Obama at a 95% confidence level.  (In fact, the confidence is higher because of the strongly anti-Obama response, but I’m too lazy to calculate it at the moment).

 

Hashtag Hijack: #Forward moving the President Backwards

I wrote, earlier, about how the attempt to hijack the hash tag #DontDoubleMyRate didn’t really work out too well.  Well, a few days have passed, and now the hashtag du jour is #Forward, and once again conservatives are attempting to take over the tag for their own purposes.

Will they fail like last time? Nope.  This time they’re pulling it off.  In a review of roughly 15,000 posts up to midnight, 4/30/2012 (EDT), the uses of #Forward are:

Roughly two thirds of all tweets using the hash tag are anti-Obama.

Compare this to what happened with #DontDoubleMyRate:

I think we can draw the conclusion that if you come up with a hash tag that personally resonates with your constituency, they’ll tweet their hearts out.  The number of tweets for the #DontDoubleMyRate hash tag is about 4 times larger than for #Forward, and the difference is probably the added supporters of Obama.  I suspect that there’s going to be a consistent pool of conservatives who will jump on (and trash) any hash tag Obama is using, and if the pro-obama tweeple don’t get excited, the hash tag is going to go down in flames.

Methodology:

I retrieved 15,038 tweets using the hashtag #forward prior to 5/1/2012, which was all the tweets using #forward  I could find.  Of those, I randomly examined 375 to determine if the tweet was pro- or anti-obama or just unrelated (a few soccer and basketball forwards in the mix).  That determination is admittedly subjective, but is really only likely to be in question for a small # of tweets (most were abundantly clear that they were anti-obama.  Some required looking at the contents of a URL to determine the intent, and for the 5 or 6 that were that way I just marked them as no being anti-Obama.)The sample size allows me to estimate the percentage of anti-Obama tweets is 68% +/- 5%, with a confidence level of 95%. Statistics FTW!

Obama Gets a Huge Boost from Jimmy Fallon – Week in Review

On Tuesday night, 4/24/2012. President Barack Obama went on the Jimmy Fallon show, and produced the best ratings in years for Fallon and a big spike in twitter mentions:

Click to Enlarge

We can see the next day Twitter was abuzz.  There’s been criticism of the President from the conservative side of things about the appearance, but it’s clear as a political move it was shrewd.  We’ll see in next week’s analysis whether Saturday’s appearance at the White House Correspondent’s dinner will have the sam effect.

Mitt Romney, on the other hand, got a bit of a boost from his primary victories on Tuesday, but it was no where near what the President saw.  Romney really needs to push harder on Social Media if he’s going to be competitive in the fall.  Fortunately, he has plenty of time to work on it…

Did the Republicans hijack the Hashtag #DontDoubleMyRate ?

You see a lot of comments on Twitter and elsewhere that the republicans managed to hijack the hash tag #DontDoubleMyRate to use to express opposition to Obama.  Usually, these comments come with a lot of glee that the conservatives have out-smarted the liberals.

So, did the hashtag get hijacked?

In a word, No.

There were 48578 tweets between 2012-04-18 11:04:19 and 2012-04-28 12:49:03 that used the hashtag.  Of those, only 14% or approximately 7,000 contained anti-Obama or just conservative messages.  There were probably as many spam messages!

The conservatives can say, all they want, that they managed to take over #DontDoubleMyRate, but the facts in this case, as Steven Colbert says, have a liberal bias.

Methodology:

A random sample of 376 tweets out of the total 48578 were selected programmatically and then read, by me, to be assessed as being either “conservative” or not. I was generous in my assessment, as some tweets are not terribly articulate.  54 of them were plausibly conservative.  54/376 = 14.36%    Thus, the estimated percentage of “conservative” tweets is 14.4% +/- 3.5% with a 95% confidence level.  At a 99% confidence level, the +/- is 4.6%.