Overview
Sentiment Analysis and Term Selection demo based on this Discovery Europe 2021 presentation.
Data is from US Federal Reserve Beige Book reports from May 1970 through October 2020. Each Beige Book report describes economic conditions and outlook based on qualitative data (e.g., interviews with business leaders). It is published by the Federal Reserve eight times annually at both the national and district levels.
Sentiment Analysis of the Beige Book provides a quantitative measure of the Federal Reserve’s degree of optimism or pessimism about the economy, which may be a useful economic indicator. See this real-world example of an economist reporting on Beige Book sentiment. In this example, we show that Beige Book sentiment is a leading indicator of economic recessions and that it tracks historical events like the Dotcom Bust or the Great Recession.
Term Selection can be applied to the Beige Book to identify terms associated with economic recessions. This has potential to reveal specific concepts that are drivers or consequences of recessions, and it also can be used to screen for potential sentiment terms. In this example, informative terms like "postpone", "cutback", and "cancel" are revealed, suggesting that Beige Book mention of disruption to planned economic activities may be an important indicator of recession.
There are two data sets for demoing: one for Sentiment Analysis and another for Term Selection.
- Beige Book – Sentiment.jmp contains 5,268 district-level reports. Table scripts are included for Sentiment Analysis and for two visualizations: (1) Sentiment Over Time shows sentiment tracking with periods of economic recession (shown in red), and (2) a geographic map showing sentiment in the twelve Federal Reserve districts across time (e.g., sentiment in the San Francisco region rising and rapidly falling during the Dotcom Bust, 1999-2001). The map requires custom map files, also included here.
- Beige Book – Term Selection.jmp contains 436 national-level reports as well as a binary variable indicating whether the US economy was in a recession on the publication date. The lone table script launches Term Selection, with the top 1000 terms as predictors and Recession as the outcome variable (“Recession” is target level).
For a possible demo flow, see the Discovery presentation linked to below.
Important things to be aware of:
- The Sentiment Analysis script adds approximately 100 custom sentiment terms and phrases to the default sentiment dictionary. In real-world practice, further customization, including more fine-grained specification of scores and removing of inappropriate default sentiment terms, would be necessary. If during a demo you see a term that should (or shouldn’t) be included in the dictionary, or a score that you disagree with, it is a good opportunity to demonstrate how easy it is to customize the dictionary interactively.
- The Sentiment Analysis script triggers syntactic parsing of all reports when you run it the first time. This can take several minutes to complete due to the number and length of reports. Resulting parses are cached on your machine for a period of time, but they may eventually be deleted per operating system settings. Always run the script at least 15 minutes before you demo to ensure the parses are cached when you subsequently launch the analysis in front of a customer. In an emergency, you can cancel the parsing and still get results, though accuracy of negation and intensification will suffer.
- The scripts use custom regex during tokenizing to remove the section headers in curly brackets present throughout each report. See the Set Regex() call in the table script.
A third data set is included: Beige Book Raw – Section Content.jmp. This includes both district-level and national reports broken out by HTML section headers present in the raw data. These data can be used to attempt analyses with respect to specific economic domains (e.g., manufacturing, retail, labor). Unfortunately, reports are not consistent in naming (or even having) sections, meaning that some section title recoding would be necessary. Still, there is opportunity for exploring domain-specific sentiment and relationship to common economic indicators (e.g., determining whether “employment” section sentiment tracks with unemployment rates).
Thanks to Xan Gregg for the idea to analyze the Beige Book and for scraping and processing the raw HTML into JMP tables.
Products and Scripted Platforms
Products: JMP Pro 16
Scripted Platforms: Text Explorer (Sentiment Analysis, Term Selection), Graph Builder
Data Source
Files
- Beige Book – Sentiment.jmp: District-level reports for Sentiment Analysis
- Beige Book – Term Selection.jmp: National-level reports for Term Selection
- Beige Book Raw – Section Content.jmp: National- and district-level reports by report section; for further exploration if desired
- Fed District Map.zip: Custom map files for Federal Reserve Districts
Example demo