This project was developed at HackCU Boulder in response to the prompt posed by OppenheimerFunds, a global asset management firm. We were tasked with finding a relationship between social/emotional trends and financial trends. In response to the current and contentious debate on gun control, our team aimed to identify whether a correlation exists between public sentiment on gun violence and firearm stock prices following a mass shooting.

What it does

Our model uses tone analysis to gauge the mood of Facebook users commenting on public news articles about gun control and violence. This data is then analyzed using multiple linear regression to see whether negative emotion correlates with a drop in firearm stock prices. Our method therefore allows us to observe longitudinal trends while offering predictive power for future price changes based on the emotional climate of Facebook users.

How we built it

Defining Variables: In order to measure public opinion on mass shootings and gun control, we employed the IBM Watson tone analyzer. This program uses "social listening" to interpret and predict the mood of individuals posting content online. It allowed us to comb through thousands of Facebook comments, discussion threads, and news articles to gauge individuals' levels of joy, sadness, anger, and tentativeness. To pinpoint a financial trend we looked at the market share values of the top two firearms companies in America. We used Google Finance and Yahoo Money to pull up the change in share values per day, month, and year.

Retrieving Data: We used Facebook graphs API to retrieve statuses and comments from popular news sources (CNN, ABC, and The New York Times) and ran this content through the Watson Tone Analyzer. The tone analyzer focused on key emotional words to determine how each poster felt about certain issues. We also kept track of the number of likes and the volume of content each event generated. The data was placed in a CSV file and then processed using a multivariable linear regression.

Statistical Analysis: To calculate the correlation between emotion and firearm stock prices we used Python to conduct a multivariate linear regression. Our linear regression model tests the idea that dimensions of joy, happiness, anger, sadness, and tentativeness all work in tandem to explain drastic, but temporary, changes in stock prices. This model also allows us to explain the effect size of each emotion, the corresponding beta unit change, and the proportion of variation emotions explain in the entire model

Applications in finance

Tracking short-term movements: A sentiment analysis drawn from Facebook user data can assist fundamental investors in forecasting favorable buy-in prices based on volume trends. It can also help investors determine breakout patterns, as seen in the RGR breakout in December 2012 following the Sandy Hook shooting.

Tracking reactions over time: Assessing reactions to current events can help analysts predict whether emotionally-driven investing decisions repeat when similar events occur in the future. Through cross-referencing Facebook users' opinions on gun control with corresponding firearm stock values, investors can ballpark where firearm stock prices will be if future shootings unfold.

Estimating the effects of social influencers: On February 22nd, 2018, President Donald Trump announced, via Twitter, his desire for tighter background checks for gun purchases. This potential curb on gun ownership created a frenzy for people who felt the need to stock up in case of stricter legislation. This caused shares of gunmakers American Outdoor Brands (AOBC) and Sturm Ruger & Company (RGR) to temporarily soar. While most Republican presidents have been historically anti-gun control, Trump's recent call for tighter restrictions brought firearm stock values out of a 2 year slump following his election in 2016. Anticipating the reactions of the general public may provide useful insight on how social influencers can create short-term dips or spikes in the market.

Challenges we ran into

A challenge we faced when pulling Facebook news articles using key words was risking the possibility that the same words could have different meanings. For example, using the word "shooting" could pull up content related to firearms or basketball. It was difficult to manually sift through hundreds of articles in search of the right ones. Under less time constraint we could have created a word search program that scans phrases rather than singular words. Additionally, we struggled to find older social media content dating back to 2012, since social media sites including Twitter and Facebook often delete or restrict access to older material. Future research should include a larger sample size and a wider sample of news outlets in order to detect stronger and more accurate correlations.

Share this project: