• Economic Data Analysis
  • Preface
    • Introduction
    • Author
    • Book Navigation
  • Part I
  • Part I: Introduction to R
  • 1 Software Overview
  • 2 Software Installation
    • 2.1 Install R
    • 2.2 Install RStudio
    • 2.3 Install R Markdown
    • 2.4 Install LaTeX
    • 2.5 Install R Packages
    • 2.6 18-Step Test
  • 3 R Basics
    • 3.1 RStudio Interface
    • 3.2 Basic Operations
      • 3.2.1 Arithmetic Operations
      • 3.2.2 Logical Operations
      • 3.2.3 String Operations
      • 3.2.4 Variables
      • 3.2.5 Data Types
      • 3.2.6 Data Structures
      • 3.2.7 Vector Operations
      • 3.2.8 Missing Values
      • 3.2.9 Attributes
    • 3.3 Dates and Times
      • 3.3.1 Time Class (POSIXct)
      • 3.3.2 Date Class (Date)
      • 3.3.3 Custom Date and Time Formats
      • 3.3.4 Operations with Dates and Times
      • 3.3.5 Current Date and Time
    • 3.4 Graphs
      • 3.4.1 Scatter Plot
      • 3.4.2 Line Graph
      • 3.4.3 Bar Chart
      • 3.4.4 Frequency Bar Chart
      • 3.4.5 Histogram
    • 3.5 Functions
      • 3.5.1 How Functions Operate
      • 3.5.2 Infix Operators
      • 3.5.3 Control-Flow Operators
      • 3.5.4 Help and Documentation
      • 3.5.5 Default Inputs
      • 3.5.6 Custom Functions
      • 3.5.7 Functions from R Packages
      • 3.5.8 Indirect Functions
      • 3.5.9 Apply Functions
      • 3.5.10 Advanced Higher-Order Functions
      • 3.5.11 Wrapper Functions
    • 3.6 R Packages
      • 3.6.1 CRAN
      • 3.6.2 Load and Update Packages
      • 3.6.3 Noteworthy Packages
      • 3.6.4 Package Documentation
      • 3.6.5 Function Name Conflicts
      • 3.6.6 Non-Exported Functions
      • 3.6.7 The Tidyverse
      • 3.6.8 Citing R Packages
    • 3.7 File Management
      • 3.7.1 Find Folder Path
      • 3.7.2 Set Working Directory
      • 3.7.3 Download Files
      • 3.7.4 Import Files
      • 3.7.5 Export Files
      • 3.7.6 Delete Files
    • 3.8 Optimal Workflow
      • 3.8.1 Execute as You Write
      • 3.8.2 Key Shortcuts
      • 3.8.3 Separate Window for R Script
      • 3.8.4 Conclusion
  • 4 Data Structures in R
    • 4.1 Scalar
    • 4.2 Vector
    • 4.3 Matrix (matrix)
      • 4.3.1 Create a Matrix
      • 4.3.2 Inspect a Matrix
      • 4.3.3 Select and Modify
      • 4.3.4 Add Labels
      • 4.3.5 Handle Missing Values
      • 4.3.6 Element-Wise Operations
      • 4.3.7 Linear Algebra Operations
      • 4.3.8 Combine Matrices
      • 4.3.9 Apply Family
    • 4.4 List (list)
      • 4.4.1 Create a List
      • 4.4.2 Inspect a List
      • 4.4.3 Select and Modify
      • 4.4.4 Add Labels
      • 4.4.5 Combine Lists
      • 4.4.6 Apply Family
    • 4.5 Data Frame (data.frame)
      • 4.5.1 Create a Data Frame
      • 4.5.2 Inspect a Data Frame
      • 4.5.3 Select and Modify
      • 4.5.4 Add Labels
      • 4.5.5 Handle Missing Values
      • 4.5.6 Combine Data Frames
      • 4.5.7 Apply Family
      • 4.5.8 Reshape Data Frames
    • 4.6 Tibble (tbl_df)
      • 4.6.1 Create a Tibble
      • 4.6.2 Inspect a Tibble
      • 4.6.3 Select and Modify
      • 4.6.4 Add Labels
      • 4.6.5 Handle Missing Values
      • 4.6.6 Combine Tibbles
      • 4.6.7 Apply Family
      • 4.6.8 Reshape Tibbles
    • 4.7 Data Table (data.table)
    • 4.8 Extensible Time Series (xts)
      • 4.8.1 Create an xts Object
      • 4.8.2 Inspect an xts Object
      • 4.8.3 Select and Modify
      • 4.8.4 Add Labels
      • 4.8.5 Handle Missing Values
      • 4.8.6 Combine xts Objects
      • 4.8.7 Time Series Transformations
      • 4.8.8 Apply Family
      • 4.8.9 Resources
  • 5 Process Data in R
    • 5.1 Process Bitcoin Price Data
      • 5.1.1 Download DSV File
      • 5.1.2 Import DSV File
      • 5.1.3 Inspect Data
      • 5.1.4 Clean Data
      • 5.1.5 Visualize Data
      • 5.1.6 Export Data
    • 5.2 Process Stock and Oil Prices
      • 5.2.1 Web API
      • 5.2.2 Download via quantmod
      • 5.2.3 Download via Quandl
      • 5.2.4 Clean Data
      • 5.2.5 Plot Apple Stock Prices
      • 5.2.6 Plot Crude Oil Prices
      • 5.2.7 Merge Data
      • 5.2.8 Transform Data
      • 5.2.9 Tabulate Key Statistics
      • 5.2.10 Visualize Correlations
    • 5.3 Process House Price Data
      • 5.3.1 Download Excel Workbook
      • 5.3.2 Import Excel Workbook
      • 5.3.3 Inspect and Clean Data
      • 5.3.4 Reshape Data
      • 5.3.5 Layered Line Graphs
      • 5.3.6 Merge Data
      • 5.3.7 Transform Data
      • 5.3.8 Stationary Data
      • 5.3.9 Export Data
      • 5.3.10 Organize Data
      • 5.3.11 Univariate Statistics
      • 5.3.12 Associative Statistics
      • 5.3.13 Layered Scatter Plots
    • 5.4 Resources
  • 6 Write Reports with R Markdown
    • 6.1 Create an R Markdown Document
    • 6.2 YAML Header
    • 6.3 Markdown Syntax
    • 6.4 R Chunks
    • 6.5 Embed R Variables into Text
    • 6.6 LaTeX Syntax for Math
    • 6.7 Print Tables
    • 6.8 Referencing
      • Setting Up bookdown
      • Referencing Equations
      • Referencing Tables
      • Referencing Figures
      • Referencing Sections
    • 6.9 Escape Characters
      • Escape in Markdown Text
      • Escape in Code Chunks
      • Escaped Characters
    • 6.10 Summary and Resources
  • Part II
  • Part II: Measurement in Economics
  • 7 Economic Data Sources
    • 7.1 Types of Indicators
    • 7.2 Data Source
      • 7.2.1 Data Supplier vs. Distributor
      • 7.2.2 Bureau of Economic Analysis (BEA)
      • 7.2.3 U.S. Census Bureau
      • 7.2.4 Bureau of Labor Statistics (BLS)
      • 7.2.5 Federal Reserve Board of Governors
      • 7.2.6 U.S. Department of the Treasury
      • 7.2.7 Financial Market Exchanges
      • 7.2.8 Federal Reserve Economic Data (FRED)
      • 7.2.9 U.S. Department of Agriculture Economic Research Service (ERS)
      • 7.2.10 Bloomberg
      • 7.2.11 Yahoo Finance
      • 7.2.12 Conclusion
  • 8 Business Accounting
    • 8.1 Accounting Standards
    • 8.2 Accounting Equation
    • 8.3 Balance Sheet
      • 8.3.1 Assets
      • 8.3.2 Liabilities
      • 8.3.3 Equity
      • 8.3.4 Transactions
      • 8.3.5 Book vs. Market Value
      • 8.3.6 Public Company
      • 8.3.7 Financial Firm
    • 8.4 Ledger
      • 8.4.1 Ledger Accounts
      • 8.4.2 T-Accounts
      • 8.4.3 Basis for Financial Statements
    • 8.5 Income Statement
      • 8.5.1 Stock vs. Flow Variables
      • 8.5.2 Profit Equation
      • 8.5.3 Gross Profit
      • 8.5.4 Operating Income (EBIT)
      • 8.5.5 Net Income Before Taxes (EBT)
      • 8.5.6 Net Income (EAT)
      • 8.5.7 Transactions
      • 8.5.8 Corporate Income Tax
    • 8.6 Cash Flow Statement
      • 8.6.1 Operating Activities
      • 8.6.2 Investing Activities
      • 8.6.3 Financing Activities
      • 8.6.4 Net Change in Cash
      • 8.6.5 Supplemental Information
      • 8.6.6 Free Cash Flows
    • 8.7 Conclusion
  • 9 Financial Performance Indicators
    • 9.1 Profitability Indicators
      • 9.1.1 Net Profit Margin
      • 9.1.2 Return on Assets (ROA)
      • 9.1.3 Return on Investment (ROI)
      • 9.1.4 Return on Equity (ROE)
      • 9.1.5 Earnings Per Share (EPS)
      • 9.1.6 Operating Margin
      • 9.1.7 Dividend Yield
      • 9.1.8 Gross Profit Margin
      • 9.1.9 Return on Capital Employed (ROCE)
    • 9.2 Liquidity Indicators
      • 9.2.1 Current Ratio
      • 9.2.2 Quick Ratio
      • 9.2.3 Cash Ratio
      • 9.2.4 Operating Cash Flow Ratio
    • 9.3 Leverage Indicators
      • 9.3.1 Debt-to-Equity (D/E) Ratio
      • 9.3.2 Interest Coverage Ratio
      • 9.3.3 Debt Ratio
      • 9.3.4 Debt-to-Capital Ratio
      • 9.3.5 Equity Multiplier
    • 9.4 Efficiency Indicators
      • 9.4.1 Asset Turnover Ratio
      • 9.4.2 Inventory Turnover Ratio
      • 9.4.3 Receivables Turnover Ratio
      • 9.4.4 Payables Turnover Ratio
      • 9.4.5 Days Sales Outstanding (DSO)
      • 9.4.6 Fixed Asset Turnover Ratio
    • 9.5 Valuation Indicators
      • 9.5.1 Price-to-Book (P/B) Ratio
      • 9.5.2 Price-to-Earnings (P/E) Ratio
      • 9.5.3 Price-to-Sales (P/S) Ratio
      • 9.5.4 Enterprise Value-to-EBITDA (EV/EBITDA)
      • 9.5.5 Dividend Yield
      • 9.5.6 Price-to-Cash Flow (P/CF) Ratio
    • 9.6 Cash Flow Indicators
      • 9.6.1 Free Cash Flow to Equity (FCFE)
      • 9.6.2 Free Cash Flow to the Firm (FCFF)
      • 9.6.3 Operating Cash Flow (OCF)
      • 9.6.4 FCF Margin
      • 9.6.5 Cash Conversion Cycle (CCC)
    • 9.7 Temporal Dimensions
      • 9.7.1 Trailing Twelve Months (TTM)
      • 9.7.2 Annual Reporting
      • 9.7.3 Quarterly and Monthly Reporting
      • 9.7.4 Example and Explanation
    • 9.8 Conclusion
  • 10 Macroeconomic Accounting
    • 10.1 Important Terms and Definitions
    • 10.2 National Accounts
      • 10.2.1 Production Approach
      • 10.2.2 Expenditure Approach
      • 10.2.3 Income Approach
      • 10.2.4 Other Flow Measures
      • 10.2.5 Stock Measures
      • 10.2.6 Implicit Price Deflators
      • 10.2.7 Data Collection
      • 10.2.8 Resources
    • 10.3 Balance of Payments
      • 10.3.1 Current Account
      • 10.3.2 Capital Account
      • 10.3.3 Financial Account
      • 10.3.4 Stock Measures
      • 10.3.5 Data Collection
      • 10.3.6 Resources
    • 10.4 Labor Market Accounts
      • 10.4.1 Labor Force
      • 10.4.2 Employment, Unemployment, and Hours Worked
      • 10.4.3 Productivity Measures
      • 10.4.4 Wage and Labor Earnings
      • 10.4.5 Job Vacancy and Turnover Rate
      • 10.4.6 Job Creation and Destruction
      • 10.4.7 Data Collection
      • 10.4.8 Resources
    • 10.5 Fiscal Accounts
      • 10.5.1 Government Budget
      • 10.5.2 Types of Taxes
      • 10.5.3 Types of Subsidies
      • 10.5.4 Non-Tax Revenue
      • 10.5.5 Data Collection
      • 10.5.6 Resources
    • 10.6 Monetary and Financial Accounts
      • 10.6.1 Monetary Aggregates
      • 10.6.2 Interest Rates
      • 10.6.3 Banking Reserves
      • 10.6.4 Credit Aggregates
      • 10.6.5 Exchange Rates
      • 10.6.6 Parity Conditions
      • 10.6.7 Industrial Production and Capacity Utilization
      • 10.6.8 Data Collection
      • 10.6.9 Resources
    • 10.7 Price Level and Inflation
      • 10.7.1 Implicit Measurement
      • 10.7.2 Direct Measurement
      • 10.7.3 Inflation
      • 10.7.4 Data Collection
      • 10.7.5 Resources
  • 11 Financial Market Indicators
    • 11.1 Interest Rates
      • 11.1.1 Import CSV File
      • 11.1.2 Plotting Historical Yields
      • 11.1.3 Plotting Yield Curve
  • Part III
  • Part III: Economic Data Processing
  • 12 Data Categorization
    • 12.1 Qualitative vs. Quantitative
    • 12.2 Discrete vs. Continuous
    • 12.3 Levels of Measurement
      • 12.3.1 Nominal Scale Variables
      • 12.3.2 Ordinal Scale Variables
      • 12.3.3 Interval Scale Variables
      • 12.3.4 Ratio Scale Variables
    • 12.4 Index vs. Absolute Data
      • 12.4.1 Index Data
      • 12.4.2 Absolute Data
    • 12.5 Stock vs. Flow
      • 12.5.1 Stock Variables
      • 12.5.2 Flow Variables
      • 12.5.3 Accounting
    • 12.6 Data Dimensions
      • 12.6.1 Cross-Sectional Data
      • 12.6.2 Time Series Data
      • 12.6.3 Panel Data
      • 12.6.4 Spatial Data
      • 12.6.5 Clustered Data
    • 12.7 Conclusion
  • 13 Data Transformation
    • 13.1 Example Data
    • 13.2 Growth
      • 13.2.1 Definition
      • 13.2.2 Log Approximation
      • 13.2.3 Relativity
      • 13.2.4 Return and Inflation
      • 13.2.5 Applicability
    • 13.3 Differentiation
      • 13.3.1 Definition
      • 13.3.2 Percentage Points (pp)
      • 13.3.3 Basis Points (bp)
    • 13.4 Natural Logarithm
      • 13.4.1 Definition
      • 13.4.2 Motivation
      • 13.4.3 Applicability
    • 13.5 Ratio
      • 13.5.1 Definition
      • 13.5.2 Per Capita
      • 13.5.3 Real vs. Nominal
      • 13.5.4 Growth of Ratios
    • 13.6 Gap
    • 13.7 Filtering
      • 13.7.1 Frequency Filtering
      • 13.7.2 Detrending
      • 13.7.3 Seasonal Adjustment
  • 14 Statistical Measures
  • 15 Data Aggregation
    • 15.1 Annualization
      • 15.1.1 Motivation
      • 15.1.2 Annualized Flow Variables
      • 15.1.3 Annualized Growth Rates
      • 15.1.4 Annualized Log-Difference
    • 15.2 Year over Year (YoY)
      • 15.2.1 Year over Year (YoY) Growth Rates
      • 15.2.2 Comparing YoY Measures with Moving Averages
      • 15.2.3 Sliding Window vs. Fixed Window Aggregation
  • Part IV
  • Part IV: Patterns in Economics
  • 16 Temporal Patterns
    • 16.1 Time Series Data
      • 16.1.1 Definition
      • 16.1.2 Features
      • 16.1.3 Visualization
    • 16.2 Trend
      • 16.2.1 Sustained Growth
      • 16.2.2 Decrease in Poverty
      • 16.2.3 Aging Population
      • 16.2.4 Productivity-Labor Trade-Off
      • 16.2.5 Trend Inflation
      • 16.2.6 Decline in Labor Share
    • 16.3 Seasonality
      • 16.3.1 Holiday Season
      • 16.3.2 Seasonal Weather
      • 16.3.3 Seasonal Employment
    • 16.4 Business Cycle
      • 16.4.1 Costs of Business Cycles
      • 16.4.2 Cyclicality and Timing
      • 16.4.3 Consumption Smoothing
  • 17 Regional Patterns
    • 17.1 Regional Data
    • 17.2 County-Level Patterns
    • 17.3 State-Level Patterns
    • 17.4 Country-Level Patterns
  • 18 Microeconomic Patterns
    • 18.1 Microeconomic Data
    • 18.2 Firm Patterns
    • 18.3 Household Patterns
  • 19 Causal Relationships
    • 19.1 Elasticities
    • 19.2 Multipliers
    • 19.3 Causality
  • Part V
  • Part V: Insights From Real-Time Data and Surveys
  • 20 Why Subjective Information Matters
  • 21 Insights From Consumer Surveys
    • 21.1 Introduction
    • 21.2 Conducting the Survey
    • 21.3 Michigan Consumer Indices
      • 21.3.1 Index of Consumer Sentiment (ICS)
      • 21.3.2 Index of Current Economic Conditions (ICC)
      • 21.3.3 Index of Consumer Expectations (ICE)
      • 21.3.4 Importing in R
      • 21.3.5 Import TSV File
      • 21.3.6 Plotting Consumer Indices
    • 21.4 Creating Custom Consumer Indices
    • 21.5 Importing and Cleaning Individual-Level Surveys
      • 21.5.1 Data Source
      • 21.5.2 Data Labels
      • 21.5.3 Importing the Data Set
      • 21.5.4 Long Format
      • 21.5.5 Saving the Data
    • 21.6 Exploring Individual-Level Data
    • 21.7 Replicate ICS
    • 21.8 Conclusion
  • 22 Insights From Real-Time Data
  • 23 Insights From Forecaster Data
    • 23.1 Tealbook
      • 23.1.1 Import Excel Workbook
      • 23.1.2 Nowcast and Backcast
      • 23.1.3 Information Date and Realization Date
      • 23.1.4 Plotting Forecasts
      • 23.1.5 Plotting Forecast Errors
  • Part VI
  • Part VI: Insights From Textual Data
  • 24 Text Analysis and Mining
  • 25 Insights From Google Trends
  • 26 Insights From Newspapers
  • 27 Insights From Social Media
  • Modules
  • Modules Overview
  • Textbook Engagement
  • Learn R with DataCamp
    • Prepare for the Course
    • XP System and Course Completion
    • Develop Your Skills
  • Data Report Instructions
    • Versions of the Data Report
    • Standards for the Two PDFs
    • Collaboration Guidelines
    • Example of a Data Report
    • Final Remarks
  • A Introduction to R
    • A.1 Overview
    • A.2 Learning Objectives
    • A.3 Learning Activities & Assessments
    • A.4 Data Report on Stock Returns
  • B Financial Performance Indicators
    • B.1 Overview
    • B.2 Learning Objectives
    • B.3 Learning Activities & Assessments
    • B.4 Data Report on Financial Performance Indicators
  • C Macroeconomic Accounting
    • C.1 Overview
    • C.2 Learning Objectives
    • C.3 Learning Activities & Assessments
    • C.4 Data Report on Macroeconomic Indicators
  • D Financial Market Indicators
    • D.1 Overview
    • D.2 Learning Objectives
    • D.3 Learning Activities & Assessments
    • D.4 Data Report on Yield Curves
  • E Economic Data Processing
    • E.1 Overview
    • E.2 Learning Objectives
    • E.3 Learning Activities & Assessments
    • E.4 Data Report on Economic Growth
  • F Temporal Patterns in Economics
    • F.1 Overview
    • F.2 Learning Objectives
    • F.3 Learning Activities & Assessments
    • F.4 Data Report on Temporal Patterns
  • G Regional Patterns in Economics
    • G.1 Overview
    • G.2 Learning Objectives
    • G.3 Learning Activities & Assessments
    • G.4 Data Report on Regional Patterns
  • H Insights From Consumer Surveys
    • H.1 Overview
    • H.2 Learning Objectives
    • H.3 Learning Activities & Assessments
    • H.4 Data Report on Consumer Indices
  • References
  • Julian F. Ludwig

Economic Data Analysis

Chapter 25 Insights From Google Trends

This chapter delves into how search query data from Google Trends can offer economic insights.