Economics-Thesis

所属分类:自然语言处理
开发工具:R
文件大小:1457KB
下载次数:0
上传日期:2021-01-26 18:42:23
上 传 者sh-1993
说明:  “新闻媒体能影响股市吗”——推特情绪分析案例研究
("Can the News Media Influence the Stock Market " A Twitter Sentiment Analysis Case Study)

文件列表:
1-CSV Input (0, 2021-01-27)
1-CSV Input\SP500.csv (4439, 2021-01-27)
1-CSV Input\UNRATENSA.csv (195, 2021-01-27)
1-CSV Input\gdp.csv (99, 2021-01-27)
1-CSV Input\trump_wsj.csv (18898505, 2021-01-27)
2-Code (0, 2021-01-27)
2-Code\Twitter Scraper.py (1732, 2021-01-27)
2-Code\newscleaning.R (4774, 2021-01-27)
3-Output (0, 2021-01-27)
3-Output\modeldf.csv (13110, 2021-01-27)
3-Output\onlyfear.csv (1138, 2021-01-27)
tfg-twitter-sp500.Rproj (205, 2021-01-27)

# Thesis: "Can the news media influence the stock market?" > A Twitter Sentiment Analysis Case Study ## General info The whole point of this project was to test the power of sentiment analysis with a practical case study. The stock market depends on investor's decisions. Decisions depend on expectations. Expectations depend on information. And information is supplied by the news media. Therefore, maybe the news media can influence the stock market, at least in an indirect way. To test this hypothesis: 1. I scrapped over nine thousand tweets published during 2016 from The Economist, The Wall Street Journal, and Bloomberg, which tracked the presidential elections (Trump vs Clinton) 2. I classified the sentiment of the tweets via the syuzhet package. Each tweet received a sentiment score over 8 emotions and 2 valences 3. I ran a statistical test to check if a specific sentiment (fear) could influence the S&P500 Index The results were surprising: even after controlling for macroeconomical variables, fear sentiment affected the stock market in a significant way. The surprising thing is that increasing fear drove the market up instead of down, which is counterintuitive. ## Setup I used · R (3.6.2 ver) · Python (3.7.6 ver) More recent versions can be used. The Python scrapper doesn't require OAuth identification, so you won't need to create a Twitter Developer Account. Install both programs, install the required packages, change the query parameters if you wish, and you're good to go! ## Features * Twitter Scrapper: The Python script is ready to scrap tweets. All you need to do is to modify the search terms to suit your needs. * Sentiment Analysis: The R Script cleans the tweets, runs the sentiment analysis, and an OLS regression to test if a sentiment is relevant * CSVs with macroeconomic data from 2016: GDP, Unemployment Rates, and the S&P500 prices, by week. ## Status Finished ## Inspiration My thesis tutor inspired me to do "something different" for my thesis. At first I thought about testing the relationship between the sentiment of american politician's tweets and the exchange rate of cryptocurrencies. Such project was impossible: almost no politicians talked about cryptos, so the sample size was too low. Then I found [a paper that found a relevant relationship between the news media and consumer sentiment](https://ideas.repec.org/p/fip/fedgfe/2004-51.html). I thought it would be interesting to test if the news media could also affect investors. ## Contact Created by [Daniel Belena](https://www.linkedin.com/in/daniel-bele%C3%B1a-gonz%C3%A1lez-949917146/?locale=en_US) - feel free to contact me!

近期下载者

相关文件


收藏者