Category Archives: R

Opinion on Obamacare among the tweeple is changing

The Affordable Care Act (ACA), now colloquially known as Obamacare, passed with a narrow margin in March 2010, with congressional votes roughly along party lines. Such ideological divide over the law has cast a long shadow over people’s opinion about it  – some well considered, others may be not so much. Now that the law has been implemented, people’s opinion about the law may be changing. History tells us, there was  similar opposition to the Social Security Act (1935) and the Medicare Act (1965), with opinions deeply divided over idealogical lines. However, both the social security and medicare are well accepted in the american society today; so much so that the same stripe of politicians who opposed them some decades earlier, are now seen to scamper to its defense.

Tracking if opinion about the law has been changing over time may provide us with insight about whether it is gaining acceptance in the country. Organizations like Gallup conduct telephone surveys every few months to gather data on people’s opinion about the law. Newer techniques like Sentiment analysis may offer an easier and faster way of finding people’s opinion about the law.

In order to do such analysis I used data from Twitter to mine people’s opinion about the law. I used the TwitteR package for R, written by Jeff Gentry, to download 1000 tweets every week about Obamacare. I then used an approach used by Jeff Breen to score the sentiment in these tweets  over a period of time. With this approach, each tweet is chopped down to its individual words and these words are then compared to a lexicon of positive and negative words. A score is then given for each tweet depending upon the number of positive or negative words present in the tweet. A positive score denotes a positive sentiment whereas a negative score denotes a negative sentiment. A score of zero denotes a neutral sentiment.

I labelled all tweets with a negative score as  a negative sentiment and those with a positive score as a positive sentiment. Tweets with a score of zero were labelled a neutral sentiment.

Here are the results from the data for the last few months.



Overall opinion about Obamacare seems to be more negative than positive. However, based on these results the total number of tweeple (read Twitter people) with either a negative or a neutral opinion about Obamacare seems to be falling while the number of people with a positive opinion about Obamacare seems to be increasing. The dotted lines in the adjacent graph represent the overall temporal trend of opinion about the law among Twitter users. If these trends were to continue, opinion about Obamacare will be more positive than negative in the next few weeks.

As a comparison, here are the results from Gallup’s survey until May 2014. It is difficult to exactly compare between the two results for  1) Gallup’s survey asked people a dichotomous question about opinion about the law 2) they cover different time periods

One concern about using Obamacare as a search term was that the word essentially had derogatory connotations about it when it was first used. That may be changing with time, as the word finds more use in the mainstream, but using ACA as a search term for the law in Twitter gave inaccurate results and #ACA just does not seem to be used often enough in twitter.

While democratic controlled states have chosen to expand Medicaid, a key element of the law, some republican controlled states have chosen to do so while some others have chosen not to. This forms a sort of natural experiment where we could study if implementation of the law in any state changes opinion on the law one way or the other. In order to study such temporospatial trend, I downloaded tweets from 10 cities around the US: 2 blue state cities: Chicago and LA, 4 red state cities that expanded Medicaid under Obamacare: Columbus, Denver, Phoenix and Louisville and 4 red state cities that did not expand Medicaid under Obamacare: Memphis, Miami, Milwaukee and Houston.

Here is the spatial variation of opinion on Obamacare for these 10 cities and the US in general for the week leading unto August 1.



And here is the same for the week leading up to August 18.



Future results will follow on this blog.

I will post the code on github shortly.