SlideShare a Scribd company logo
1 of 4
Download to read offline
Sentiment Analysis
Johann Krugell
9 January 2019
Overview
On the 2nd of Jan 2019 Apple issued its first profit warning in 16 years. Underestimating the magnitude of
the economic slowdown in China was the reason for lower iphone sales and the subsequent profit warning.
There is often a lag in the availability of Economic data which means that the sentiment and underlying
financials does not correspond. In Apple’s case the sentiment may have been that sales growth was on track
and the economic conditions was supportive but the reality was that economic conditions were changing.
I wonder if there was earlier signs of a possible change in sentiment?
The Reserve Bank of Australia (RBA) publishes the minutes of its monetary policy meetings online I want to
analyse the Reserve Bank’s sentiment during 2018, ,to determine if there was an earlier change in sentiment
regarding international economic conditions (https://www.rba.gov.au/monetary-policy/rba-board-minutes/
2018/).
Sentiment analysis
Sentiment analysis is the process of grouping and analysing pieces of text to determine the writers sentiment.
Positive or negative sentiment for example. The process can also be referred to as text mining.
Sentiment analysis in R
The basic process to do sentiment analysis in R is as follows:
• data - you need text data to analyse, in this case RBA meeting minutes
• tidy - tidy the text to have a list of words, single column each word separately
• sentiment lexicon - join the list of words with a sentiment lexicon that would identify the sentiment
of each word
• visualize - visualize the result
Data
I copied the section of text related to international economic conditions into Notepad and imported it into R
using the readtsv function.
int_econ_cond_apr = read_tsv("int_econ_cond_apr.txt",col_names = FALSE)
I want to analyse the sentiment changes over time so at the time of importing I add the date of the meeting
int_econ_cond_apr <- mutate(int_econ_cond_apr, speech_date = as.Date("2018-04-03"))
The resulting data is a tibble with 4 rows and 2 columns
## Classes 'tbl_df', 'tbl' and 'data.frame': 4 obs. of 2 variables:
## $ X1 : chr "As a backdrop to their discussion on international economic conditions, members
## $ speech_date: Date, format: "2018-04-03" "2018-04-03" ...
1
I repeat the import process for all months and then combine the data sets into one tibble that I can use
together with the sentiment lexicon. The result is a tibble with 46 rows and two columns
## Classes 'tbl_df', 'tbl' and 'data.frame': 60 obs. of 2 variables:
## $ X1 : chr "Members commenced their discussion of the global economy by noting that GDP gro
## $ speech_date: Date, format: "2018-10-02" "2018-10-02" ...
Tidy
Once all the data has been collected it needs to be tidy. Each row of text in the data it should be split into
one row for each word. You want to see two columns with one row for each word
You can move each word in the row to its own row using the unnest function.
sentiment <- unnest_tokens(int_econ_cond_combined, word, X1)
The result is a data frame with two columns, word and speech date, a total of 6,958 observations
## Classes 'tbl_df', 'tbl' and 'data.frame': 6958 obs. of 2 variables:
## $ speech_date: Date, format: "2018-10-02" "2018-10-02" ...
## $ word : chr "members" "commenced" "their" "discussion" ...
Sentiment Lexicon
The next step is to join your data frame with a sentiment lexicon. A lexicon is a set of meaningful units in a
language. We will be using the nrc lexicon.
I can join this lexicon to my data frame using the innerjoin function
inner_join(sentiment, get_sentiments("nrc"), by = "word")
## # A tibble: 1,497 x 3
## speech_date word sentiment
## <date> <chr> <chr>
## 1 2018-10-02 discussion positive
## 2 2018-10-02 economy trust
## 3 2018-10-02 growth positive
## 4 2018-10-02 trend positive
## 5 2018-10-02 timely positive
## 6 2018-10-02 growth positive
## 7 2018-10-02 expected anticipation
## 8 2018-10-02 solid positive
## 9 2018-10-02 noted positive
## 10 2018-10-02 trade trust
## # ... with 1,487 more rows
Now you will see for each word in the speech and the corresponding sentiment of that word in a separate
column.
I add some additional columns to count the number of occurrences of a positive or negative sentiment. My
data frame now looks as follows
## # A tibble: 859 x 7
## # Groups: sentiment, speech_date [107]
## word sentiment speech_date n total percent date
## <chr> <chr> <date> <int> <int> <dbl> <date>
## 1 absorbed positive 2018-09-04 2 86 0.0233 2018-09-01
## 2 advanced positive 2018-09-04 2 86 0.0233 2018-09-01
## 3 agreement positive 2018-09-04 1 86 0.0116 2018-09-01
## 4 content positive 2018-09-04 1 86 0.0116 2018-09-01
2
## 5 contribute positive 2018-09-04 1 86 0.0116 2018-09-01
## 6 core positive 2018-09-04 2 86 0.0233 2018-09-01
## 7 discussion positive 2018-09-04 1 86 0.0116 2018-09-01
## 8 encouragement positive 2018-09-04 1 86 0.0116 2018-09-01
## 9 growth positive 2018-09-04 21 86 0.244 2018-09-01
## 10 including positive 2018-09-04 3 86 0.0349 2018-09-01
## # ... with 849 more rows
Visualize
The last step is to visualize the result. I can see that overall the sentiment has be significantly more positive
than negative. However from Sep onwards there is a change in positive sentiment.
25
50
75
Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Meeting month
TotalObservations
sentiment negative positive
RBA monetary meetings sentiment − positive/negative
The decrease in positive sentiment has not been accompanied by and increase in negative sentiment. If I plot
positive sentiment together with surprise sentiment, this change in sentiment seems to be accompanied by an
increase in words with a sentiment of surprise.
3
0.0
0.5
1.0
1.5
2.0
Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Meeting month
Countofsentiment
sentiment positive surprise
RBA monetary meetings sentiment − positive/surprise
4

More Related Content

Similar to Sentiment Analysis - Reserve Bank Monetary Policy Meetings

IRJET- Sentimental Analysis of Twitter for Stock Market Investment
IRJET- Sentimental Analysis of Twitter for Stock Market InvestmentIRJET- Sentimental Analysis of Twitter for Stock Market Investment
IRJET- Sentimental Analysis of Twitter for Stock Market InvestmentIRJET Journal
 
BUSI 331Marketing Research Report Part 3 InstructionsData .docx
BUSI 331Marketing Research Report Part 3 InstructionsData .docxBUSI 331Marketing Research Report Part 3 InstructionsData .docx
BUSI 331Marketing Research Report Part 3 InstructionsData .docxhumphrieskalyn
 
We need your input!As the CFO of IPS, you are responsible for ma.docx
We need your input!As the CFO of IPS, you are responsible for ma.docxWe need your input!As the CFO of IPS, you are responsible for ma.docx
We need your input!As the CFO of IPS, you are responsible for ma.docxnealralix138661
 
FInal Project Intelligent Social Media Analytics
FInal Project Intelligent Social Media AnalyticsFInal Project Intelligent Social Media Analytics
FInal Project Intelligent Social Media AnalyticsAshwin Dinoriya
 
Date dimension in your data warehouse
Date dimension in your data warehouseDate dimension in your data warehouse
Date dimension in your data warehouseDirk Cludts
 
STOCK TREND PREDICTION USING NEWS SENTIMENT ANALYSIS
STOCK TREND PREDICTION USING NEWS SENTIMENT ANALYSISSTOCK TREND PREDICTION USING NEWS SENTIMENT ANALYSIS
STOCK TREND PREDICTION USING NEWS SENTIMENT ANALYSISijcsit
 
Stock Market Prediction
Stock Market PredictionStock Market Prediction
Stock Market PredictionMRIDUL GUPTA
 
Introduction to need of forecasting in business
Introduction to need of forecasting in businessIntroduction to need of forecasting in business
Introduction to need of forecasting in businessAnuyaK1
 
Data warehouse project on retail store
Data warehouse project on retail storeData warehouse project on retail store
Data warehouse project on retail storeSiddharth Chaudhary
 
Part OneFirst, use the provided  MS Excel Spreadshe.docx
Part OneFirst, use the provided             MS Excel Spreadshe.docxPart OneFirst, use the provided             MS Excel Spreadshe.docx
Part OneFirst, use the provided  MS Excel Spreadshe.docxLacieKlineeb
 
Live Twitter Sentiment Analysis and Interactive Visualizations with PyLDAvis ...
Live Twitter Sentiment Analysis and Interactive Visualizations with PyLDAvis ...Live Twitter Sentiment Analysis and Interactive Visualizations with PyLDAvis ...
Live Twitter Sentiment Analysis and Interactive Visualizations with PyLDAvis ...IRJET Journal
 
Report 190804110930
Report 190804110930Report 190804110930
Report 190804110930udara12345
 
Predicting Bank Customer Churn Using Classification
Predicting Bank Customer Churn Using ClassificationPredicting Bank Customer Churn Using Classification
Predicting Bank Customer Churn Using ClassificationVishva Abeyrathne
 
SDSU Accounting Information SystemsMS Television, Inc. Expenditu.docx
SDSU Accounting Information SystemsMS Television, Inc. Expenditu.docxSDSU Accounting Information SystemsMS Television, Inc. Expenditu.docx
SDSU Accounting Information SystemsMS Television, Inc. Expenditu.docxkenjordan97598
 
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri FontainePython and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri FontaineCitus Data
 
IRJET - Forecasting Stock Market Movement Direction using Sentiment Analysis ...
IRJET - Forecasting Stock Market Movement Direction using Sentiment Analysis ...IRJET - Forecasting Stock Market Movement Direction using Sentiment Analysis ...
IRJET - Forecasting Stock Market Movement Direction using Sentiment Analysis ...IRJET Journal
 

Similar to Sentiment Analysis - Reserve Bank Monetary Policy Meetings (20)

Bis 219 final exam
Bis 219 final examBis 219 final exam
Bis 219 final exam
 
IRJET- Sentimental Analysis of Twitter for Stock Market Investment
IRJET- Sentimental Analysis of Twitter for Stock Market InvestmentIRJET- Sentimental Analysis of Twitter for Stock Market Investment
IRJET- Sentimental Analysis of Twitter for Stock Market Investment
 
BUSI 331Marketing Research Report Part 3 InstructionsData .docx
BUSI 331Marketing Research Report Part 3 InstructionsData .docxBUSI 331Marketing Research Report Part 3 InstructionsData .docx
BUSI 331Marketing Research Report Part 3 InstructionsData .docx
 
We need your input!As the CFO of IPS, you are responsible for ma.docx
We need your input!As the CFO of IPS, you are responsible for ma.docxWe need your input!As the CFO of IPS, you are responsible for ma.docx
We need your input!As the CFO of IPS, you are responsible for ma.docx
 
FInal Project Intelligent Social Media Analytics
FInal Project Intelligent Social Media AnalyticsFInal Project Intelligent Social Media Analytics
FInal Project Intelligent Social Media Analytics
 
Date dimension in your data warehouse
Date dimension in your data warehouseDate dimension in your data warehouse
Date dimension in your data warehouse
 
STOCK TREND PREDICTION USING NEWS SENTIMENT ANALYSIS
STOCK TREND PREDICTION USING NEWS SENTIMENT ANALYSISSTOCK TREND PREDICTION USING NEWS SENTIMENT ANALYSIS
STOCK TREND PREDICTION USING NEWS SENTIMENT ANALYSIS
 
Stock Market Prediction
Stock Market PredictionStock Market Prediction
Stock Market Prediction
 
Unstructured Data Management
Unstructured Data ManagementUnstructured Data Management
Unstructured Data Management
 
Introduction to need of forecasting in business
Introduction to need of forecasting in businessIntroduction to need of forecasting in business
Introduction to need of forecasting in business
 
Data warehouse project on retail store
Data warehouse project on retail storeData warehouse project on retail store
Data warehouse project on retail store
 
Bis 219 week 3 d qs
Bis 219 week 3 d qsBis 219 week 3 d qs
Bis 219 week 3 d qs
 
Part OneFirst, use the provided  MS Excel Spreadshe.docx
Part OneFirst, use the provided             MS Excel Spreadshe.docxPart OneFirst, use the provided             MS Excel Spreadshe.docx
Part OneFirst, use the provided  MS Excel Spreadshe.docx
 
Live Twitter Sentiment Analysis and Interactive Visualizations with PyLDAvis ...
Live Twitter Sentiment Analysis and Interactive Visualizations with PyLDAvis ...Live Twitter Sentiment Analysis and Interactive Visualizations with PyLDAvis ...
Live Twitter Sentiment Analysis and Interactive Visualizations with PyLDAvis ...
 
Report 190804110930
Report 190804110930Report 190804110930
Report 190804110930
 
Predicting Bank Customer Churn Using Classification
Predicting Bank Customer Churn Using ClassificationPredicting Bank Customer Churn Using Classification
Predicting Bank Customer Churn Using Classification
 
SDSU Accounting Information SystemsMS Television, Inc. Expenditu.docx
SDSU Accounting Information SystemsMS Television, Inc. Expenditu.docxSDSU Accounting Information SystemsMS Television, Inc. Expenditu.docx
SDSU Accounting Information SystemsMS Television, Inc. Expenditu.docx
 
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri FontainePython and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
 
battery pa report.docx
battery pa report.docxbattery pa report.docx
battery pa report.docx
 
IRJET - Forecasting Stock Market Movement Direction using Sentiment Analysis ...
IRJET - Forecasting Stock Market Movement Direction using Sentiment Analysis ...IRJET - Forecasting Stock Market Movement Direction using Sentiment Analysis ...
IRJET - Forecasting Stock Market Movement Direction using Sentiment Analysis ...
 

More from Johann Krugell

Quandl, r and power bi
Quandl, r and power biQuandl, r and power bi
Quandl, r and power biJohann Krugell
 
Power ups non standard column names
Power ups non standard column namesPower ups non standard column names
Power ups non standard column namesJohann Krugell
 
Power ups filter a slicer
Power ups filter a slicerPower ups filter a slicer
Power ups filter a slicerJohann Krugell
 
Power ups Static segmentation
Power ups Static segmentationPower ups Static segmentation
Power ups Static segmentationJohann Krugell
 
Power ups Parameters PowerBI
Power ups Parameters PowerBIPower ups Parameters PowerBI
Power ups Parameters PowerBIJohann Krugell
 
Power Ups Ledger FX Rate
Power Ups Ledger FX RatePower Ups Ledger FX Rate
Power Ups Ledger FX RateJohann Krugell
 

More from Johann Krugell (6)

Quandl, r and power bi
Quandl, r and power biQuandl, r and power bi
Quandl, r and power bi
 
Power ups non standard column names
Power ups non standard column namesPower ups non standard column names
Power ups non standard column names
 
Power ups filter a slicer
Power ups filter a slicerPower ups filter a slicer
Power ups filter a slicer
 
Power ups Static segmentation
Power ups Static segmentationPower ups Static segmentation
Power ups Static segmentation
 
Power ups Parameters PowerBI
Power ups Parameters PowerBIPower ups Parameters PowerBI
Power ups Parameters PowerBI
 
Power Ups Ledger FX Rate
Power Ups Ledger FX RatePower Ups Ledger FX Rate
Power Ups Ledger FX Rate
 

Recently uploaded

100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 

Recently uploaded (20)

100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 

Sentiment Analysis - Reserve Bank Monetary Policy Meetings

  • 1. Sentiment Analysis Johann Krugell 9 January 2019 Overview On the 2nd of Jan 2019 Apple issued its first profit warning in 16 years. Underestimating the magnitude of the economic slowdown in China was the reason for lower iphone sales and the subsequent profit warning. There is often a lag in the availability of Economic data which means that the sentiment and underlying financials does not correspond. In Apple’s case the sentiment may have been that sales growth was on track and the economic conditions was supportive but the reality was that economic conditions were changing. I wonder if there was earlier signs of a possible change in sentiment? The Reserve Bank of Australia (RBA) publishes the minutes of its monetary policy meetings online I want to analyse the Reserve Bank’s sentiment during 2018, ,to determine if there was an earlier change in sentiment regarding international economic conditions (https://www.rba.gov.au/monetary-policy/rba-board-minutes/ 2018/). Sentiment analysis Sentiment analysis is the process of grouping and analysing pieces of text to determine the writers sentiment. Positive or negative sentiment for example. The process can also be referred to as text mining. Sentiment analysis in R The basic process to do sentiment analysis in R is as follows: • data - you need text data to analyse, in this case RBA meeting minutes • tidy - tidy the text to have a list of words, single column each word separately • sentiment lexicon - join the list of words with a sentiment lexicon that would identify the sentiment of each word • visualize - visualize the result Data I copied the section of text related to international economic conditions into Notepad and imported it into R using the readtsv function. int_econ_cond_apr = read_tsv("int_econ_cond_apr.txt",col_names = FALSE) I want to analyse the sentiment changes over time so at the time of importing I add the date of the meeting int_econ_cond_apr <- mutate(int_econ_cond_apr, speech_date = as.Date("2018-04-03")) The resulting data is a tibble with 4 rows and 2 columns ## Classes 'tbl_df', 'tbl' and 'data.frame': 4 obs. of 2 variables: ## $ X1 : chr "As a backdrop to their discussion on international economic conditions, members ## $ speech_date: Date, format: "2018-04-03" "2018-04-03" ... 1
  • 2. I repeat the import process for all months and then combine the data sets into one tibble that I can use together with the sentiment lexicon. The result is a tibble with 46 rows and two columns ## Classes 'tbl_df', 'tbl' and 'data.frame': 60 obs. of 2 variables: ## $ X1 : chr "Members commenced their discussion of the global economy by noting that GDP gro ## $ speech_date: Date, format: "2018-10-02" "2018-10-02" ... Tidy Once all the data has been collected it needs to be tidy. Each row of text in the data it should be split into one row for each word. You want to see two columns with one row for each word You can move each word in the row to its own row using the unnest function. sentiment <- unnest_tokens(int_econ_cond_combined, word, X1) The result is a data frame with two columns, word and speech date, a total of 6,958 observations ## Classes 'tbl_df', 'tbl' and 'data.frame': 6958 obs. of 2 variables: ## $ speech_date: Date, format: "2018-10-02" "2018-10-02" ... ## $ word : chr "members" "commenced" "their" "discussion" ... Sentiment Lexicon The next step is to join your data frame with a sentiment lexicon. A lexicon is a set of meaningful units in a language. We will be using the nrc lexicon. I can join this lexicon to my data frame using the innerjoin function inner_join(sentiment, get_sentiments("nrc"), by = "word") ## # A tibble: 1,497 x 3 ## speech_date word sentiment ## <date> <chr> <chr> ## 1 2018-10-02 discussion positive ## 2 2018-10-02 economy trust ## 3 2018-10-02 growth positive ## 4 2018-10-02 trend positive ## 5 2018-10-02 timely positive ## 6 2018-10-02 growth positive ## 7 2018-10-02 expected anticipation ## 8 2018-10-02 solid positive ## 9 2018-10-02 noted positive ## 10 2018-10-02 trade trust ## # ... with 1,487 more rows Now you will see for each word in the speech and the corresponding sentiment of that word in a separate column. I add some additional columns to count the number of occurrences of a positive or negative sentiment. My data frame now looks as follows ## # A tibble: 859 x 7 ## # Groups: sentiment, speech_date [107] ## word sentiment speech_date n total percent date ## <chr> <chr> <date> <int> <int> <dbl> <date> ## 1 absorbed positive 2018-09-04 2 86 0.0233 2018-09-01 ## 2 advanced positive 2018-09-04 2 86 0.0233 2018-09-01 ## 3 agreement positive 2018-09-04 1 86 0.0116 2018-09-01 ## 4 content positive 2018-09-04 1 86 0.0116 2018-09-01 2
  • 3. ## 5 contribute positive 2018-09-04 1 86 0.0116 2018-09-01 ## 6 core positive 2018-09-04 2 86 0.0233 2018-09-01 ## 7 discussion positive 2018-09-04 1 86 0.0116 2018-09-01 ## 8 encouragement positive 2018-09-04 1 86 0.0116 2018-09-01 ## 9 growth positive 2018-09-04 21 86 0.244 2018-09-01 ## 10 including positive 2018-09-04 3 86 0.0349 2018-09-01 ## # ... with 849 more rows Visualize The last step is to visualize the result. I can see that overall the sentiment has be significantly more positive than negative. However from Sep onwards there is a change in positive sentiment. 25 50 75 Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Meeting month TotalObservations sentiment negative positive RBA monetary meetings sentiment − positive/negative The decrease in positive sentiment has not been accompanied by and increase in negative sentiment. If I plot positive sentiment together with surprise sentiment, this change in sentiment seems to be accompanied by an increase in words with a sentiment of surprise. 3
  • 4. 0.0 0.5 1.0 1.5 2.0 Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Meeting month Countofsentiment sentiment positive surprise RBA monetary meetings sentiment − positive/surprise 4