Predicting Stock Market Changes Using Twitter

It took 10 million tweets, but researchers have built a mood index that can accurately determine market activity

Looking to exploit the stock market? The key to making millions may be as close as your Twitter feed.

In a new paper, researchers at Indiana University, Bloomington's School of Informatics and Computing claim to have found the correlation between the value of the Dow Jones Industrial Average and public sentiment as measured through Twitter. PhysOrg reports that Associate Professor Johan Bollen and Ph.D. candidate Huina Mao were able to use millions of tweets to  generate an algorithm that effectively predicts the impact of changes in the public attitude toward the economy on the performance of the stock market.

Students of history know well that financial panics can be self-fulfilling prophecies, with investors' panic over a perceived crisis leading to an actual crash. But past researchers have concluded that the influence of news events or major crises, while obviously connected to the behavior of the stock market, is essentially unpredictable given the difficulty of efficiently measuring their impact on public attitudes toward the economy in some sort of consistent index. In their paper, Bollen and Mao contend that early indicators of economic behavior could be extracted from social media outlets like Twitter, the mediums closest to real-time changes in the public mood. As Bollen and Mao write, large surveys of the public mood from representative samples -- like a Gallup poll or other consumer indices -- are too expensive or time-consuming to conduct, while more informal gauges of moods (like asking a group of people on the street) are generally inaccurate. A tweet, on the other hand, is a perfect unit for measuring changes in the public mood; confined to 140 character morsels and already subject to aggregation by various social media software, Twitter feeds are an easily mined source of public sentiment.

Bollen and Mao used two tools to measure variations in the public mood from tweets. The first was OpinionFinder, an online mood-tracking service, which analyzed the content of tweets submitted on a given day to provide a positive vs. negative series of public mood, a sort of baseline for the mood of the Twittersphere. The second was a standard psychological tool, the Google-Profile of Mood States (GPOMS), that produced a more subtle scale for measuring moods, generating a series of public moods over days -- calm, alert, sure, vital, kind and happy -- to provide a more detailed and nuanced view of change in public sentiment.

Bollen and Mao analyzed more than 9.8 million tweets from 2.7 million users during 10 months in 2008. To ensure that their mood index was properly applied, they only took into account tweets that contained explicit statements of mood (i.e. those with expressions like "I am," "I am feeling," or "makes me") and filtered out information-oriented tweets (or those with URLs).

The resulting public mood time series was then compared to the closing values of stocks in the Dow Jones Industrial Average to assess their ability to predict changes. By implementing a prediction model called a Self-Organizing Fuzzy Neural Network (SOFFNN) -- which, according to Bollen and Mao, is similar to one already used to successfully forecast electrical load needs -- the researchers demonstrated that looking at public mood had the ability to significantly improve the accuracy of the most basic models currently used to predict closing stock values. "We were not interested in proposing an optimal Dow Jones prediction model, but rather to assess the effects of including public mood information on the accuracy of the baseline prediction model," Bollen told PhysOrg. "What we found was an accuracy of 87.6 percent in predicting the daily up and down changes in the closing values of the Dow Jones Industrial Average."

According to Bollen, the odds of the prediction accuracy rate of 87.6 percent being sheer chance were then calculated for a random period of 20 days and determined to be just 3.4 percent.

"I sank into my chair. That's a pretty big result," Bollen told Wired. "It was one of those 'Eureka!' moments."

The researchers found that the calmness index was the best predictor of fluctuations in the Dow, predicting whether the market would close up or down between two and six days after a reading was recorded on Twitter. Bollen hopes that his model will have future applications. "Given the performance increase for a relatively basic model such as the SOFNN, we are hopeful to find equal or better improvements for more sophisticated market models that may in fact include other information derived from news sources and a variety of relevant economic indicators," he said.

Since Twitter had its political coming-out party during the Iranian election protests of 2008, its use as a tool to capture the "wisdom of the crowds" has been subject to debate. After all, what can researchers really tell about society as an aggregate from the jabber on networks like Twitter and Facebook and the often skewed consensus of sprawling communities like Digg, Reddit and 4chan? Bollen and Mao's research hints at a more disciplined application of crowdsourcing, an algorithim that captures and translates the emotional and psychological forces that comprise human behavior and influence, however slightly, the invisible hands of markets.