Text Mining in R: Are Pokémon GO Mentions Really Driving Up Stock Prices?

This post was originally published at DataCamp. Check out their other curated blog posts.

Introduction: What Bloomberg Terminal’s News Trends Feature (Doesn’t) Show

On a nondescript commute in late July, In the aftermath of the Brexit vote in England and the rise of the hugely popular game called Pokémon GO, I was listening to Bloomberg radio on my way to work. Bloomberg had taken a brief detour from Brexit and the daily musings of the market to instead focus on technology stocks and how to use a Bloomberg Terminal feature called NT (News Trends) to illustrate the information of both news trends and stock prices, aggregating topic mentions across many news sources as a time series. From the description that is all the feature of the $20,000 a month service does. Admittedly I haven’t been in front of a terminal since grad school and I do not remember the NT feature.

The awkward radio broadcast covered a game the “kids” were playing called Pokémon GO and its relationship with Nintendo’s stock. As the conversation wore on detailing how to use NT within a terminal and thereby illustrate the service’s value proposition, Hilary Clark begrudgingly stated that “the stock ticks up for Nintendo were driven… By the mentions of Pokémon GO” and later added, “the value out of this function [NT] is just to see what is driving up the stock price.”

Now, as a text miner, I take particular note of word choice. In communication theory, a message’s meaning lies with the destination not the sender or channel. This means the word choice, tone and medium have an impact on the audience’s comprehension and ascribed attitudes towards the message. You probably already know this inherently, but it is important to note: choosing your words, tone and channel correctly affects the message meaning, anyone who is married knows this firsthand :).

I am guessing you, a DataCamp blog reader, already identified a flaw in Clark’s word choice: as an authority (sender) speaking on an authoritative radio (channel) broadcast, she’s uses words like “driven” (message) in the NT service, which includes a correlation calculation. An unsophisticated consumer of this message may interpret a causal affect from her words and may even attempt to trade stocks using the NT service. However, as the sophisticated audience (destination) that we are, we own the meaning and therefore get to recreate what we think the NT service is and determines its value for ourselves. If it’s so valuable to be part of a $20,000 a month service, then we should be able to gain some novel insight using Google News Trends and Yahoo’s stock service.

Let’s make our own News Trends feature for free and see how awesome a poor man’s Bloomberg Terminal’s NT service could be!

Create Your Own R News Trends Feature

Load the Libraries

To start load the libraries we will need to make the visuals. The quantmod library is a popular R package for importing stock market data. Next, gridExtra and grid are needed to arrange the two resulting visuals. Both ggplot2 and ggthemes are used to construct the time series. ggplot2 is a great grammar of graphics library, while ggthemes provides premade palettes for easy implementation. Lastly, the gtrendsR package provides an interface to get Google Trends data.

It could be that you need to install packages if you don’t have them installed yet. In that case, use for example the install.packages("gtrendsR") command to import the gtrendsR package.

 

Now that you have the data set, check out the rest of this post at DataCamp!

This entry was posted in blog posts, DataCamp, EDA and tagged , , , . Bookmark the permalink.