Introduction

Every two years our nation goes thru the process of electing out government officials. It seems every year the bipartisan rhetoric gets stronger and strong. Many claims are made on what happens to the economy when either party is in control, of the President’s office, the Senate or the House. Coming right out of the mid-terms, looking at what next year brings economically is certainly of interest to all.

Gathering data from the Federal Reserve’s FRED service ( https://fred.stlouisfed.org ) and from scrapping results from elections from the web (such as https://transition.fec.gov/pubrec/electionresults.shtm), we can build a model of what next year has in store.

We would start out by selecting economic indicators from the FRED site. Selecting interesting indicators will be done using Wickham’s workflow. Data will be imported, made tidy, possible transformations applied and then thru visualization the most “interesting” indicators will be selected.

Electoral data will include the number of senate and house seats in congress the year after an election. Using this data together with our economic indicators, models will be built to predict a certain economic indicator. Several models can be used, presenting results from each in graphical form. We can also classify monthly economic data with a good, medium and poor economy tag. Once we do this we can train a classifier to tell us what the economic outlook might be given an input of congress seats.

There seems to be the notion that Python is a better language for machine learning and running classifiers. As a stretch got for this project, to experiment with something not covered in class, we can try running python code in RStudio using the reticulate library. If this is possible, training a classifier using the popular sci-kitlearn package in Python and comparing them with results in r, could give us a clue into which is better at machine learning.

Workflow

We will use Hadley Wickman’s Tidy Workflow as show below.

Loading required libraries

library("rvest")
## Loading required package: xml2
library(tidyr)
require(mongolite)
## Loading required package: mongolite
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)

library(FredR)
## Warning: replacing previous import 'data.table::first' by 'dplyr::first'
## when loading 'FredR'
## Warning: replacing previous import 'data.table::between' by
## 'dplyr::between' when loading 'FredR'
## Warning: replacing previous import 'data.table::last' by 'dplyr::last' when
## loading 'FredR'
library(pipeR)
library(kableExtra)

Import Data

Economic Indicators Dataset

The Federal Reserve’s database has a selection of economic indicators. For this analysis we will look at GDP (Gross Domestic Product) indicators as a proxy for the health of the economy. To select an indicator we can first explore GDP indicators available.

api.key = "4844eb6986119824760163e60bddd945"
fred<-FredR(api.key)

gdp.series <- fred$series.search("GDP")
gdp.series %>% kable() %>% kable_styling() %>% scroll_box(height = "400px")
id realtime_start realtime_end title observation_start observation_end frequency frequency_short units units_short seasonal_adjustment seasonal_adjustment_short last_updated popularity group_popularity notes
GDPC1 2018-12-09 2018-12-09 Real Gross Domestic Product 1947-01-01 2018-07-01 Quarterly Q Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:02-06 94 98 BEA Account Code: A191RX Real gross domestic product is the inflation adjusted value of the goods and services produced by labor and property located in the United States.For more information see the Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
GDP 2018-12-09 2018-12-09 Gross Domestic Product 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:02-06 92 93 BEA Account Code: A191RC Gross domestic product (GDP), the featured measure of U.S. output, is the market value of the goods and services produced by labor and property located in the United States.For more information, see the Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
A191RL1Q225SBEA 2018-12-09 2018-12-09 Real Gross Domestic Product 1947-04-01 2018-07-01 Quarterly Q Percent Change from Preceding Period % Chg. from Preceding Period Seasonally Adjusted Annual Rate SAAR 2018-10-26 07:51:03-05 89 98 BEA Account Code: A191RL Gross domestic product (GDP) is the value of the goods and services produced by the nation’s economy less the value of the goods and services used up in production. GDP is also equal to the sum of personal consumption expenditures, gross private domestic investment, net exports of goods and services, and government consumption expenditures and gross investment. Real values are inflation-adjusted estimates—that is, estimates that exclude the effects of price changes. For more information about this series, please see http://www.bea.gov/national/.
PAYEMS 2018-12-09 2018-12-09 All Employees: Total Nonfarm Payrolls 1939-01-01 2018-11-01 Monthly M Thousands of Persons Thous. of Persons Seasonally Adjusted SA 2018-12-07 08:11:02-06 85 85 All Employees: Total Nonfarm, commonly known as Total Nonfarm Payroll, is a measure of the number of U.S. workers in the economy that excludes proprietors, private household employees, unpaid volunteers, farm employees, and the unincorporated self-employed. This measure accounts for approximately 80 percent of the workers who contribute to Gross Domestic Product (GDP). This measure provides useful insights into the current economic situation because it can represent the number of jobs added or lost in an economy. Increases in employment might indicate that businesses are hiring which might also suggest that businesses are growing. Additionally, those who are newly employed have increased their personal incomes, which means (all else constant) their disposable incomes have also increased, thus fostering further economic expansion. Generally, the U.S. labor force and levels of employment and unemployment are subject to fluctuations due to seasonal changes in weather, major holidays, and the opening and closing of schools. The Bureau of Labor Statistics (BLS) adjusts the data to offset the seasonal effects to show non-seasonal changes: for example, women’s participation in the labor force; or a general decline in the number of employees, a possible indication of a downturn in the economy. To closely examine seasonal and non-seasonal changes, the BLS releases two monthly statistical measures: the seasonally adjusted All Employees: Total Nonfarm (PAYEMS) and All Employees: Total Nonfarm (PAYNSA), which is not seasonally adjusted. The series comes from the ‘Current Employment Statistics (Establishment Survey).’ The source code is: CES0000000001
GFDEGDQ188S 2018-12-09 2018-12-09 Federal Debt: Total Public Debt as Percent of Gross Domestic Product 1966-01-01 2018-07-01 Quarterly Q Percent of GDP % of GDP Seasonally Adjusted SA 2018-11-29 14:51:02-06 84 84 Federal Debt: Total Public Debt as Percent of Gross Domestic Product (GFDEGDQ188S) was first constructed by the Federal Reserve Bank of St. Louis in October 2012. It is calculated using Federal Government Debt: Total Public Debt (GFDEBTN) and Gross Domestic Product, 1 Decimal (GDP): GFDEGDQ188S = ((GFDEBTN/1000)/GDP)*100 GFDEBTN/1000 transforms GFDEBTN from millions of dollars to billions of dollars.
M2V 2018-12-09 2018-12-09 Velocity of M2 Money Stock 1959-01-01 2018-07-01 Quarterly Q Ratio Ratio Seasonally Adjusted SA 2018-10-26 15:51:01-05 84 84 Calculated as the ratio of quarterly nominal GDP (https://fred.stlouisfed.org/series/GDP) to the quarterly average of M2 money stock (https://fred.stlouisfed.org/series/M2SL). The velocity of money is the frequency at which one unit of currency is used to purchase domestically- produced goods and services within a given time period. In other words, it is the number of times one dollar is spent to buy goods and services per unit of time. If the velocity of money is increasing, then more transactions are occurring between individuals in an economy. The frequency of currency exchange can be used to determine the velocity of a given component of the money supply, providing some insight into whether consumers and businesses are saving or spending their money. There are several components of the money supply,: M1, M2, and MZM (M3 is no longer tracked by the Federal Reserve); these components are arranged on a spectrum of narrowest to broadest. Consider M1, the narrowest component. M1 is the money supply of currency in circulation (notes and coins, traveler’s checks [non-bank issuers], demand deposits, and checkable deposits). A decreasing velocity of M1 might indicate fewer short- term consumption transactions are taking place. We can think of shorter- term transactions as consumption we might make on an everyday basis. The broader M2 component includes M1 in addition to saving deposits, certificates of deposit (less than $100,000), and money market deposits for individuals. Comparing the velocities of M1 and M2 provides some insight into how quickly the economy is spending and how quickly it is saving. MZM (money with zero maturity) is the broadest component and consists of the supply of financial assets redeemable at par on demand: notes and coins in circulation, traveler’s checks (non-bank issuers), demand deposits, other checkable deposits, savings deposits, and all money market funds. The velocity of MZM helps determine how often financial assets are switching hands within the economy.
A939RX0Q048SBEA 2018-12-09 2018-12-09 Real gross domestic product per capita 1947-01-01 2018-07-01 Quarterly Q Chained 2012 Dollars Chn. 2012 $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:02-06 79 79 BEA Account Code: A939RX For more information about this series, please see http://www.bea.gov/national/.
GDPDEF 2018-12-09 2018-12-09 Gross Domestic Product: Implicit Price Deflator 1947-01-01 2018-07-01 Quarterly Q Index 2012=100 Index 2012=100 Seasonally Adjusted SA 2018-11-28 07:51:02-06 79 79 BEA Account Code: A191RD The number of decimal places reported varies over time. A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
HDTGPDUSQ163N 2018-12-09 2018-12-09 Household Debt to GDP for United States 2005-01-01 2016-10-01 Quarterly Q Ratio Ratio Not Seasonally Adjusted NSA 2017-04-27 10:01:01-05 78 78 The data for household debt comprise debt incurred by resident households of the economy only. This FSI measures the overall level of household indebtedness (commonly related to consumer loans and mortgages) as a share of GDP. Copyright © 2016, International Monetary Fund. Reprinted with permission. Complete terms of use and contact details are available at http://www.imf.org/external/terms.htm.
GDPPOT 2018-12-09 2018-12-09 Real Potential Gross Domestic Product 1949-01-01 2028-10-01 Quarterly Q Billions of Chained 2009 Dollars Bil. of Chn. 2009 $ Not Seasonally Adjusted NSA 2018-08-27 14:01:02-05 77 77 Real potential GDP is the CBO’s estimate of the output the economy would produce with a high rate of use of its capital and labor resources. The data is adjusted to remove the effects of inflation.
NROU 2018-12-09 2018-12-09 Natural Rate of Unemployment (Long-Term) 1949-01-01 2028-10-01 Quarterly Q Percent % Not Seasonally Adjusted NSA 2018-08-27 14:01:02-05 76 76 The natural rate of unemployment (NAIRU) is the rate of unemployment arising from all sources except fluctuations in aggregate demand. Estimates of potential GDP are based on the long-term natural rate. (CBO did not make explicit adjustments to the short-term natural rate for structural factors before the recent downturn.) The short-term natural rate incorporates structural factors that are temporarily boosting the natural rate beginning in 2008. The short-term natural rate is used to gauge the amount of current and projected slack in labor markets, which is a key input into CBO’s projections of inflation.
DDDM01USA156NWDB 2018-12-09 2018-12-09 Stock Market Capitalization to GDP for United States 1975-01-01 2017-01-01 Annual A Percent % Not Seasonally Adjusted NSA 2018-09-21 11:21:02-05 75 75 Total value of all listed shares in a stock market as a percentage of GDP. Value of listed shares to GDP, calculated using the following deflation method: {(0.5)*[Ft/P_et + Ft-1/P_et-1]}/[GDPt/P_at] where F is stock market capitalization, P_e is end-of period CPI, and P_a is average annual CPI. End-of period CPI (IFS line 64M..ZF or, if not available, 64Q..ZF) and annual CPI (IFS line 64..ZF) are from the IMF’s International Financial Statistics. Standard & Poor’s, Global Stock Markets Factbook and supplemental S&P data) Source Code: GFDD.DM.01
FYFSGDA188S 2018-12-09 2018-12-09 Federal Surplus or Deficit [-] as Percent of Gross Domestic Product 1929-01-01 2017-01-01 Annual A Percent of GDP % of GDP Not Seasonally Adjusted NSA 2018-10-16 11:11:01-05 75 75 Federal Surplus or Deficit [-] as Percent of Gross Domestic Product (FYFSGDA188S) was first constructed by the Federal Reserve Bank of St. Louis in October 2012. It is calculated using Federal Surplus or Deficit [-] (FYFSD) and Gross Domestic Product (GDPA): FYFSGDA188S = ((FYFSD/1000)/GDPA)*100 FYFSD/1000 transforms FYFSD from millions of dollars to billions of dollars.
CP 2018-12-09 2018-12-09 Corporate Profits After Tax (without IVA and CCAdj) 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 74 74 BEA Account Code: A055RC
GDPCA 2018-12-09 2018-12-09 Real Gross Domestic Product 1929-01-01 2017-01-01 Annual A Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Not Seasonally Adjusted NSA 2018-07-27 10:32:49-05 74 98 BEA Account Code: A191RX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
GPDI 2018-12-09 2018-12-09 Gross Private Domestic Investment 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 74 75 BEA Account Code: A006RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
GDPA 2018-12-09 2018-12-09 Gross Domestic Product 1929-01-01 2017-01-01 Annual A Billions of Dollars Bil. of $ Not Seasonally Adjusted NSA 2018-07-27 10:32:48-05 74 93 BEA Account Code: A191RC
M1V 2018-12-09 2018-12-09 Velocity of M1 Money Stock 1959-01-01 2018-07-01 Quarterly Q Ratio Ratio Seasonally Adjusted SA 2018-10-26 15:51:02-05 73 73 Calculated as the ratio of quarterly nominal GDP (https://fred.stlouisfed.org/series/GDP) to the quarterly average of M1 money stock (https://fred.stlouisfed.org/series/M1SL). The velocity of money is the frequency at which one unit of currency is used to purchase domestically- produced goods and services within a given time period. In other words, it is the number of times one dollar is spent to buy goods and services per unit of time. If the velocity of money is increasing, then more transactions are occurring between individuals in an economy. The frequency of currency exchange can be used to determine the velocity of a given component of the money supply, providing some insight into whether consumers and businesses are saving or spending their money. There are several components of the money supply,: M1, M2, and MZM (M3 is no longer tracked by the Federal Reserve); these components are arranged on a spectrum of narrowest to broadest. Consider M1, the narrowest component. M1 is the money supply of currency in circulation (notes and coins, traveler’s checks [non-bank issuers], demand deposits, and checkable deposits). A decreasing velocity of M1 might indicate fewer short- term consumption transactions are taking place. We can think of shorter- term transactions as consumption we might make on an everyday basis. The broader M2 component includes M1 in addition to saving deposits, certificates of deposit (less than $100,000), and money market deposits for individuals. Comparing the velocities of M1 and M2 provides some insight into how quickly the economy is spending and how quickly it is saving. MZM (money with zero maturity) is the broadest component and consists of the supply of financial assets redeemable at par on demand: notes and coins in circulation, traveler’s checks (non-bank issuers), demand deposits, other checkable deposits, savings deposits, and all money market funds. The velocity of MZM helps determine how often financial assets are switching hands within the economy.
W006RC1Q027SBEA 2018-12-09 2018-12-09 Federal government current tax receipts 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 73 73 BEA Account Code: W006RC For more information about this series, please see http://www.bea.gov/national/.
A191RO1Q156NBEA 2018-12-09 2018-12-09 Real Gross Domestic Product 1948-01-01 2018-07-01 Quarterly Q Percent Change from Quarter One Year Ago % Chg. from Qtr. 1 Yr. Ago Seasonally Adjusted SA 2018-10-26 07:54:03-05 71 98 BEA Account Code: A191RO For more information about this series, please see http://www.bea.gov/national/.
A191RL1A225NBEA 2018-12-09 2018-12-09 Real Gross Domestic Product 1930-01-01 2017-01-01 Annual A Percent Change from Preceding Period % Chg. from Preceding Period Not Seasonally Adjusted NSA 2018-07-27 10:21:01-05 71 98 BEA Account Code: A191RL For more information about this series, please see http://www.bea.gov/national/.
JHDUSRGDPBR 2018-12-09 2018-12-09 Dates of U.S. recessions as inferred by GDP-based recession indicator 1967-10-01 2018-04-01 Quarterly Q +1 or 0 +1 or 0 Not Seasonally Adjusted NSA 2018-10-26 15:41:01-05 71 71 The series assigns dates to U.S. recessions based on a mathematical model of the way that recessions differ from expansions. Whereas the NBER business cycle dates are based on a subjective assessment of a variety of indicators, the dates here are entirely mechanical and are calculated solely from historically reported GDP data. Whenever the GDP-based recession indicator index rises above 67%, the economy is determined to be in a recession. The date that the recession is determined to have begun is the first quarter prior to that date for which the inference from the mathematical model using all data available at that date would have been above 50%. The next time the GDP-based recession indicator index falls below 33%, the recession is determined to be over, and the last quarter of the recession is the first quarter for which the inference from the mathematical model using all available data at that date would have been below 50%. For more information about this series visit http://econbrowser.com/recession-index.
PCEC 2018-12-09 2018-12-09 Personal Consumption Expenditures 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 70 84 BEA Account Code: DPCERC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
PCECC96 2018-12-09 2018-12-09 Real Personal Consumption Expenditures 1947-01-01 2018-07-01 Quarterly Q Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 70 82 BEA Account Code: DPCERX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
NETEXP 2018-12-09 2018-12-09 Net Exports of Goods and Services 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 70 71 BEA Account Code: A019RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
A191RP1Q027SBEA 2018-12-09 2018-12-09 Gross Domestic Product 1947-04-01 2018-07-01 Quarterly Q Percent Change from Preceding Period % Chg. from Preceding Period Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 69 93 BEA Account Code: A191RP For more information about this series, please see http://www.bea.gov/national/.
GNP 2018-12-09 2018-12-09 Gross National Product 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 69 71 BEA Account Code: A001RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
MKTGDPCNA646NWDB 2018-12-09 2018-12-09 Gross Domestic Product for China 1960-01-01 2017-01-01 Annual A Current U.S. Dollars Current $ Not Seasonally Adjusted NSA 2018-09-27 13:32:21-05 68 68 GDP at purchaser’s prices is the sum of gross value added by all resident producers in the economy plus any product taxes and minus any subsidies not included in the value of the products. It is calculated without making deductions for depreciation of fabricated assets or for depletion and degradation of natural resources. Data are in current U.S. dollars. Dollar figures for GDP are converted from domestic currencies using single year official exchange rates. For a few countries where the official exchange rate does not reflect the rate effectively applied to actual foreign exchange transactions, an alternative conversion factor is used. Source Code: NY.GDP.MKTP.CD
GDPNOW 2018-12-09 2018-12-09 GDPNow 2011-07-01 2018-10-01 Quarterly Q Percent Change at Annual Rate % Chg. at Annual Rate Seasonally Adjusted Annual Rate SAAR 2018-12-07 16:41:02-06 68 68 GDPNow is a nowcasting model for gross domestic product (GDP) growth that synthesizes the bridge equation approach relating GDP subcomponents to monthly source data with factor model and Bayesian vector autoregression approaches. The GDPNow model forecasts GDP growth by aggregating 13 subcomponents that make up GDP with the chain-weighting methodology used by the US Bureau of Economic Analysis. The Federal Reserve Bank of Atlanta’s GDPNow release complements the quarterly GDP release from the Bureau of Economic Analysis (BEA). The Atlanta Fed recalculates and updates their GDPNow forecasts (called “nowcasts”) throughout the quarter as new data are released, up until the BEA releases its “advance estimate” of GDP for that quarter. The St. Louis Fed constructs a quarterly time series for this dataset, in which both historical and current observations values are combined. In general, the most-current observation is revised multiple times throughout the quarter. The final forecasted value (before the BEA’s release of the advance estimate of GDP) is the static, historical value for that quarter. For futher information visit the source at https://www.frbatlanta.org/cqer/research/gdpnow.aspx?panel=1.
STLENI 2018-12-09 2018-12-09 St. Louis Fed Economic News Index: Real GDP Nowcast 2013-04-01 2018-10-01 Quarterly Q Percent Change at Annual Rate % Chg. at Annual Rate Seasonally Adjusted Annual Rate SAAR 2018-12-07 10:01:08-06 67 67 St. Louis Fed’s Economic News Index (ENI) uses economic content from key monthly economic data releases to forecast the growth of real GDP during that quarter. In general, the most-current observation is revised multiple times throughout the quarter. The final forecasted value (before the BEA’s release of the advance estimate of GDP) is the static, historical value for that quarter. For more information, see Grover, Sean P.; Kliesen, Kevin L.; and McCracken, Michael W. “A Macroeconomic News Index for Constructing Nowcasts of U.S. Real Gross Domestic Product Growth" (https://research.stlouisfed.org/publications/review/2016/12/05/a-macroeconomic-news-index-for-constructing-nowcasts-of-u-s-real-gross-domestic-product-growth/ )
PNFI 2018-12-09 2018-12-09 Private Nonresidential Fixed Investment 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 67 67 BEA Account Code: A008RC
MZMV 2018-12-09 2018-12-09 Velocity of MZM Money Stock 1959-01-01 2018-07-01 Quarterly Q Ratio Ratio Seasonally Adjusted SA 2018-10-26 15:51:02-05 67 67 Calculated as the ratio of quarterly nominal GDP (https://fred.stlouisfed.org/series/GDP) to the quarterly average of MZM money stock (https://fred.stlouisfed.org/series/MZMSL). The velocity of money is the frequency at which one unit of currency is used to purchase domestically- produced goods and services within a given time period. In other words, it is the number of times one dollar is spent to buy goods and services per unit of time. If the velocity of money is increasing, then more transactions are occurring between individuals in an economy. The frequency of currency exchange can be used to determine the velocity of a given component of the money supply, providing some insight into whether consumers and businesses are saving or spending their money. There are several components of the money supply,: M1, M2, and MZM (M3 is no longer tracked by the Federal Reserve); these components are arranged on a spectrum of narrowest to broadest. Consider M1, the narrowest component. M1 is the money supply of currency in circulation (notes and coins, traveler’s checks [non-bank issuers], demand deposits, and checkable deposits). A decreasing velocity of M1 might indicate fewer short- term consumption transactions are taking place. We can think of shorter- term transactions as consumption we might make on an everyday basis. The broader M2 component includes M1 in addition to saving deposits, certificates of deposit (less than $100,000), and money market deposits for individuals. Comparing the velocities of M1 and M2 provides some insight into how quickly the economy is spending and how quickly it is saving. MZM (money with zero maturity) is the broadest component and consists of the supply of financial assets redeemable at par on demand: notes and coins in circulation, traveler’s checks (non-bank issuers), demand deposits, other checkable deposits, savings deposits, and all money market funds. The velocity of MZM helps determine how often financial assets are switching hands within the economy.
FYFRGDA188S 2018-12-09 2018-12-09 Federal Receipts as Percent of Gross Domestic Product 1929-01-01 2017-01-01 Annual A Percent of GDP % of GDP Not Seasonally Adjusted NSA 2018-10-16 11:11:01-05 67 67 Federal Receipts as Percent of Gross Domestic Product (FYFRGDA188S) was first constructed by the Federal Reserve Bank of St. Louis in January 2013. It is calculated using Federal Receipts (FYFR) and Gross Domestic Product (GDPA): FYFRGDA188S = ((FYFR /1000)/GDPA)*100 FYFR /1000 transforms FYFR from millions of dollars to billions of dollars.
JPNNGDP 2018-12-09 2018-12-09 Gross Domestic Product for Japan 1994-01-01 2018-04-01 Quarterly Q Billions of Yen Bil. of Yen Seasonally Adjusted SA 2018-09-10 11:31:02-05 66 68 Copyright, 2016, Cabinet Office of Japan.
GPDIC1 2018-12-09 2018-12-09 Real Gross Private Domestic Investment 1947-01-01 2018-07-01 Quarterly Q Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 66 70 BEA Account Code: A006RX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
CPGDPAI 2018-12-09 2018-12-09 Percent Change of Gross Domestic Product 2005-04-01 2018-04-01 Quarterly Q Percent Change % Chg. Seasonally Adjusted Annual Rate SAAR 2018-11-01 16:52:24-05 65 65 According to the source, value added represents the sum of the costs-incurred and the incomes-earned in production, and consists of compensation of employees, taxes on production and imports, less subsidies, and gross operating surplus.
W068RCQ027SBEA 2018-12-09 2018-12-09 Government total expenditures 1960-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:03-06 65 67 BEA Account Code: W068RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
BPCCRO1Q156NBEA 2018-12-09 2018-12-09 Personal Consumption Expenditures excluding Food and Energy (chain-type price index) 1960-01-01 2018-07-01 Quarterly Q Percent Change from Quarter One Year Ago % Chg. from Qtr. 1 Yr. Ago Seasonally Adjusted SA 2018-10-26 07:54:04-05 65 81 BEA Account Code: BPCCRO For more information about this series, please see http://www.bea.gov/national/.
FYONGDA188S 2018-12-09 2018-12-09 Federal Net Outlays as Percent of Gross Domestic Product 1929-01-01 2017-01-01 Annual A Percent of GDP % of GDP Not Seasonally Adjusted NSA 2018-10-16 11:11:01-05 65 64 Federal Net Outlays as Percent of Gross Domestic Product (FYONGDA188S) was first constructed by the Federal Reserve Bank of St. Louis in January 2013. It is calculated using Federal Net Outlays (FYONET) and Gross Domestic Product (GDPA): FYONGDA188S= ((FYONET/1000)/GDPA)*100 FYONET/1000 transforms FYONET from millions of dollars to billions of dollars.
NROUST 2018-12-09 2018-12-09 Natural Rate of Unemployment (Short-Term) 1949-01-01 2028-10-01 Quarterly Q Percent % Not Seasonally Adjusted NSA 2018-08-27 14:01:03-05 64 64 The natural rate of unemployment (NAIRU) is the rate of unemployment arising from all sources except fluctuations in aggregate demand. Estimates of potential GDP are based on the long-term natural rate. (CBO did not make explicit adjustments to the short-term natural rate for structural factors before the recent downturn.) The short-term natural rate incorporates structural factors that are temporarily boosting the natural rate beginning in 2008. The short-term natural rate is used to gauge the amount of current and projected slack in labor markets, which is a key input into CBO’s projections of inflation.
DDDM011WA156NWDB 2018-12-09 2018-12-09 Stock Market Capitalization to GDP for World 1975-01-01 2015-01-01 Annual A Percent % Not Seasonally Adjusted NSA 2017-08-30 08:08:36-05 63 63 Total value of all listed shares in a stock market as a percentage of GDP. Value of listed shares to GDP, calculated using the following deflation method: {(0.5)*[Ft/P_et + Ft-1/P_et-1]}/[GDPt/P_at] where F is stock market capitalization, P_e is end-of period CPI, and P_a is average annual CPI. End-of period CPI (IFS line 64M..ZF or, if not available, 64Q..ZF) and annual CPI (IFS line 64..ZF) are from the IMF’s International Financial Statistics. Standard & Poor’s, Global Stock Markets Factbook and supplemental S&P data) Source Code: GFDD.DM.01
CLVMNACSCAB1GQUK 2018-12-09 2018-12-09 Real Gross Domestic Product for United Kingdom 1975-01-01 2018-07-01 Quarterly Q Millions of Chained 2010 National Currency Mil. of Chn. 2010 National Currency Seasonally Adjusted SA 2018-11-14 11:01:02-06 63 65 Eurostat unit ID: CLV10_MNAC Eurostat item ID = B1GQ Eurostat country ID: UK Seasonally and calendar adjusted data. Copyright, European Union, http://ec.europa.eu, 1995-2016. Complete terms of use are available at http://ec.europa.eu/geninfo/legal_notices_en.htm#copyright
GDPC96 2018-12-09 2018-12-09 Real Gross Domestic Product (DISCONTINUED) 1947-01-01 2017-04-01 Quarterly Q Billions of Chained 2009 Dollars Bil. of Chn. 2009 $ Seasonally Adjusted Annual Rate SAAR 2017-09-28 08:11:02-05 63 66 This series has been discontinued and will no longer be updated. It was a duplicate of the following series, which will continue to be updated: https://fred.stlouisfed.org/series/GDPC1 A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
PRFI 2018-12-09 2018-12-09 Private Residential Fixed Investment 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 63 63 BEA Account Code: A011RC
CPATAX 2018-12-09 2018-12-09 Corporate Profits After Tax with Inventory Valuation Adjustment (IVA) and Capital Consumption Adjustment (CCAdj) 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 62 62 BEA Account Code: A551RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
W270RE1A156NBEA 2018-12-09 2018-12-09 Shares of gross domestic income: Compensation of employees, paid: Wage and salary accruals: Disbursements: To persons 1948-01-01 2017-01-01 Annual A Percent % Not Seasonally Adjusted NSA 2018-08-08 14:11:02-05 62 62 BEA Account Code: W270RE For more information about this series, please see http://www.bea.gov/national/.
JHGDPBRINDX 2018-12-09 2018-12-09 GDP-Based Recession Indicator Index 1967-10-01 2018-04-01 Quarterly Q Percentage Points Percentage Points Not Seasonally Adjusted NSA 2018-10-26 15:41:01-05 62 62 This index measures the probability that the U.S. economy was in a recession during the indicated quarter. It is based on a mathematical description of the way that recessions differ from expansions. The index corresponds to the probability (measured in percent) that the underlying true economic regime is one of recession based on the available data. Whereas the NBER business cycle dates are based on a subjective assessment of a variety of indicators that may not be released until several years after the event, this index is entirely mechanical, is based solely on currently available GDP data and is reported every quarter. Due to the possibility of data revisions and the challenges in accurately identifying the business cycle phase, the index is calculated for the quarter just preceding the most recently available GDP numbers. Once the index is calculated for that quarter, it is never subsequently revised. The value at every date was inferred using only data that were available one quarter after that date and as those data were reported at the time. If the value of the index rises above 67% that is a historically reliable indicator that the economy has entered a recession. Once this threshold has been passed, if it falls below 33% that is a reliable indicator that the recession is over. For more information about this series visit http://econbrowser.com/recession-index.
PCDG 2018-12-09 2018-12-09 Personal Consumption Expenditures: Durable Goods 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 62 67 BEA Account Code: DDURRC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
LABSHPUSA156NRUG 2018-12-09 2018-12-09 Share of Labour Compensation in GDP at Current National Prices for United States 1950-01-01 2014-01-01 Annual A Ratio Ratio Not Seasonally Adjusted NSA 2016-06-29 12:32:22-05 62 61 Source ID: labsh When using these data in your research, please make the following reference: Feenstra, Robert C., Robert Inklaar and Marcel P. Timmer (2015), “The Next Generation of the Penn World Table” American Economic Review, 105(10), 3150-3182, available for download at www.ggdc.net/pwt For more information, see http://www.rug.nl/research/ggdc/data/pwt/.
NGDPPOT 2018-12-09 2018-12-09 Nominal Potential Gross Domestic Product 1949-01-01 2028-10-01 Quarterly Q Billions of Dollars Bil. of $ Not Seasonally Adjusted NSA 2018-08-27 14:01:03-05 61 61 NA
CLVMNACSCAB1GQDE 2018-12-09 2018-12-09 Real Gross Domestic Product for Germany 1991-01-01 2018-07-01 Quarterly Q Millions of Chained 2010 Euros Mil. of Chn. 2010 Euros Seasonally Adjusted SA 2018-12-07 10:01:03-06 61 62 Eurostat unit ID: CLV10_MNAC Eurostat item ID = B1GQ Eurostat country ID: DE Seasonally and calendar adjusted data. For euro area member states, the national currency series are converted into euros using the irrevocably fixed exchange rate. This preserves the same growth rates than for the previous national currency series. Both series coincide for years after accession to the euro area but differ for earlier years due to market exchange rate movements. Copyright, European Union, http://ec.europa.eu, 1995-2016.Complete terms of use are available at http://ec.europa.eu/geninfo/legal_notices_en.htm#copyright
DPCERL1Q225SBEA 2018-12-09 2018-12-09 Real Personal Consumption Expenditures 1947-04-01 2018-07-01 Quarterly Q Percent Change from Preceding Period % Chg. from Preceding Period Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 61 82 BEA Account Code: DPCERL For more information about this series, please see http://www.bea.gov/national/.
JPNRGDPEXP 2018-12-09 2018-12-09 Real Gross Domestic Product for Japan 1994-01-01 2018-04-01 Quarterly Q Billions of Chained 2011 Yen Bil. of Chn. 2011 Yen Seasonally Adjusted SA 2018-09-10 11:31:02-05 61 61 Copyright, 2016, Cabinet Office of Japan.
FYGDP 2018-12-09 2018-12-09 Gross Domestic Product 1930-06-30 2017-09-30 Annual, Fiscal Year A Billions of Dollars Bil. of $ Not Seasonally Adjusted NSA 2018-03-27 14:31:01-05 61 93 NA
RGDPNACNA666NRUG 2018-12-09 2018-12-09 Real GDP at Constant National Prices for China 1952-01-01 2014-01-01 Annual A Millions of 2011 U.S. Dollars Mil. of 2011 U.S. $ Not Seasonally Adjusted NSA 2016-06-29 11:53:47-05 61 60 Source ID: rgdpna When using these data in your research, please make the following reference: Feenstra, Robert C., Robert Inklaar and Marcel P. Timmer (2015), “The Next Generation of the Penn World Table” American Economic Review, 105(10), 3150-3182, available for download at www.ggdc.net/pwt For more information, see http://www.rug.nl/research/ggdc/data/pwt/.
FYOIGDA188S 2018-12-09 2018-12-09 Federal Outlays: Interest as Percent of Gross Domestic Product 1940-01-01 2017-01-01 Annual A Percent of GDP % of GDP Not Seasonally Adjusted NSA 2018-10-16 11:11:01-05 61 60 Federal Outlays: Interest as Percent of Gross Domestic Product (FYOIGDA188S) was first constructed by the Federal Reserve Bank of St. Louis in January 2013. It is calculated using Federal Outlays: Interest (FYOINT) and Gross Domestic Product (GDPA): FYOIGDA188S= ((FYOINT/1000)/GDPA)*100 FYOINT/1000 transforms FYOINT from millions of dollars to billions of dollars.
EXPGSC1 2018-12-09 2018-12-09 Real Exports of Goods and Services 1947-01-01 2018-07-01 Quarterly Q Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 60 67 BEA Account Code: A020RX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
MKTGDP1WA646NWDB 2018-12-09 2018-12-09 Gross Domestic Product for World 1960-01-01 2015-01-01 Annual A Current Dollars Current $ Not Seasonally Adjusted NSA 2017-08-30 07:51:04-05 60 61 GDP at purchaser’s prices is the sum of gross value added by all resident producers in the economy plus any product taxes and minus any subsidies not included in the value of the products. It is calculated without making deductions for depreciation of fabricated assets or for depletion and degradation of natural resources. Data are in current U.S. dollars. Dollar figures for GDP are converted from domestic currencies using single year official exchange rates. For a few countries where the official exchange rate does not reflect the rate effectively applied to actual foreign exchange transactions, an alternative conversion factor is used. Source Code: NY.GDP.MKTP.CD
A053RC1Q027SBEA 2018-12-09 2018-12-09 National income: Corporate profits before tax (without IVA and CCAdj) 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 60 60 BEA Account Code: A053RC For more information about this series, please see http://www.bea.gov/national/.
A792RC0A052NBEA 2018-12-09 2018-12-09 Personal income per capita 1929-01-01 2017-01-01 Annual A Dollars $ Not Seasonally Adjusted NSA 2018-07-27 10:32:55-05 60 62 BEA Account Code: A792RC For more information about this series, please see http://www.bea.gov/national/.
PCECA 2018-12-09 2018-12-09 Personal Consumption Expenditures 1929-01-01 2017-01-01 Annual A Billions of Dollars Bil. of $ Not Seasonally Adjusted NSA 2018-07-27 10:32:53-05 59 84 BEA Account Code: DPCERC
A072RC1Q156SBEA 2018-12-09 2018-12-09 Personal saving as a percentage of disposable personal income 1947-01-01 2018-07-01 Quarterly Q Percent % Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 59 60 BEA Account Code: A072RC For more information about this series, please see http://www.bea.gov/national/.
PCND 2018-12-09 2018-12-09 Personal Consumption Expenditures: Nondurable Goods 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:05-06 59 63 BEA Account Code: DNDGRC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
GPSAVE 2018-12-09 2018-12-09 Gross Private Saving 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 59 60 BEA Account Code: A126RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
BPBLTT01USQ188S 2018-12-09 2018-12-09 Total Current Account Balance for the United States (DISCONTINUED) 1960-01-01 2013-10-01 Quarterly Q Percent of GDP % of GDP Seasonally Adjusted SA 2017-04-16 14:55:23-05 59 63 OECD descriptor ID: BPBLTT01 OECD unit ID: STSA OECD country ID: USA All OECD data should be cited as follows: OECD, “Main Economic Indicators - complete database”, Main Economic Indicators (database),http://dx.doi.org/10.1787/data-00052-en (Accessed on date) Copyright, 2016, OECD. Reprinted with permission.
CHNGDPNQDSMEI 2018-12-09 2018-12-09 Current Price Gross Domestic Product in China 1992-01-01 2018-07-01 Quarterly Q Billions of Chinese Yuans Bil. of Chinese Yuans Seasonally Adjusted SA 2018-11-23 12:51:19-06 59 60 Copyright, 2016, OECD. Reprinted with permission. All OECD data should be cited as follows: OECD (2010), “Main Economic Indicators - complete database”, Main Economic Indicators (database),http://dx.doi.org/10.1787/data-00052-en (Accessed on date)
A191RP1A027NBEA 2018-12-09 2018-12-09 Gross Domestic Product 1930-01-01 2017-01-01 Annual A Percent Change from Preceding Period % Chg. from Preceding Period Not Seasonally Adjusted NSA 2018-07-27 10:21:02-05 59 93 BEA Account Code: A191RP For more information about this series, please see http://www.bea.gov/national/.
GCEC1 2018-12-09 2018-12-09 Real Government Consumption Expenditures and Gross Investment 1947-01-01 2018-07-01 Quarterly Q Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 59 62 BEA Account Code: A822RX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
FGEXPND 2018-12-09 2018-12-09 Federal Government: Current Expenditures 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 58 58 BEA Account Code: W013RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
PAYNSA 2018-12-09 2018-12-09 All Employees: Total Nonfarm Payrolls 1939-01-01 2018-11-01 Monthly M Thousands of Persons Thous. of Persons Not Seasonally Adjusted NSA 2018-12-07 08:15:05-06 58 85 All Employees: Total Nonfarm, commonly known as Total Nonfarm Payroll, is a measure of the number of U.S. workers in the economy that excludes proprietors, private household employees, unpaid volunteers, farm employees, and the unincorporated self-employed. This measure accounts for approximately 80 percent of the workers who contribute to Gross Domestic Product (GDP). This measure provides useful insights into the current economic situation because it can represent the number of jobs added or lost in an economy. Increases in employment might indicate that businesses are hiring which might also suggest that businesses are growing. Additionally, those who are newly employed have increased their personal incomes, which means (all else constant) their disposable incomes have also increased, thus fostering further economic expansion. Generally, the U.S. labor force and levels of employment and unemployment are subject to fluctuations due to seasonal changes in weather, major holidays, and the opening and closing of schools. The Bureau of Labor Statistics (BLS) adjusts the data to offset the seasonal effects to show non-seasonal changes: for example, women’s participation in the labor force; or a general decline in the number of employees, a possible indication of a downturn in the economy. To closely examine seasonal and non-seasonal changes, the BLS releases two monthly statistical measures: the seasonally adjusted All Employees: Total Nonfarm (PAYEMS) and All Employees: Total Nonfarm (PAYNSA), which is not seasonally adjusted. The series comes from the ‘Current Employment Statistics (Establishment Survey).’ The source code is: CEU0000000001
IMPGSCA 2018-12-09 2018-12-09 Real Imports of Goods and Services 1929-01-01 2017-01-01 Annual A Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Not Seasonally Adjusted NSA 2018-07-27 10:32:54-05 58 66 BEA Account Code: A021RX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
FYGFGDQ188S 2018-12-09 2018-12-09 Federal Debt Held by the Public as Percent of Gross Domestic Product 1970-01-01 2018-07-01 Quarterly Q Percent of GDP % of GDP Seasonally Adjusted SA 2018-11-29 14:51:02-06 58 58 Federal Debt Held by the Public as Percent of Gross Domestic Product (FYGFGDQ188S) was first constructed by the Federal Reserve Bank of St. Louis in October 2012. It is calculated using Federal Debt Held by the Public (FYGFDPUN) and Gross Domestic Product, 1 Decimal (GDP): FYGFGDQ188S = ((FYGFDPUN/1000)/GDP)*100 FYGFDPUN/1000 transforms FYGFDPUN from millions of dollars to billions of dollars.
A006RE1Q156NBEA 2018-12-09 2018-12-09 Shares of gross domestic product: Gross private domestic investment 1947-01-01 2018-07-01 Quarterly Q Percent % Not Seasonally Adjusted NSA 2018-11-28 07:51:04-06 58 60 BEA Account Code: A006RE For more information about this series, please see http://www.bea.gov/national/.
EUNNGDP 2018-12-09 2018-12-09 Gross Domestic Product (Euro/ECU series) for Euro Area (19 Countries) 1995-01-01 2018-07-01 Quarterly Q Millions of Euros Mil. of Euros Seasonally Adjusted SA 2018-12-07 10:01:03-06 57 58 Copyright, European Union, http://ec.europa.eu, 1995-2016. Complete terms of use are available at http://ec.europa.eu/geninfo/legal_notices_en.htm#copyright" Data prior to December 31, 1998 are in Millions of ECU. Included countries: Belgium, Germany, Estonia, Ireland, Greece, Spain, France, Italy, Cyprus, Latvia, Lithuania, Luxembourg, Malta, the Netherlands, Austria, Portugal, Slovenia, Slovakia and Finland.
TXNGSP 2018-12-09 2018-12-09 Total Gross Domestic Product for Texas 1997-01-01 2017-01-01 Annual A Millions of Dollars Mil. of $ Not Seasonally Adjusted NSA 2018-11-19 16:07:36-06 57 57 NA
W790RC1Q027SBEA 2018-12-09 2018-12-09 Net domestic investment: Private: Domestic business 1960-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 57 58 BEA Account Code: W790RC For more information about this series, please see http://www.bea.gov/national/.
QUSPAM770A 2018-12-09 2018-12-09 Total Credit to Private Non-Financial Sector, Adjusted for Breaks, for United States 1952-01-01 2018-01-01 Quarterly, End of Quarter Q Percentage of GDP Percentage of GDP Not Seasonally Adjusted NSA 2018-09-24 06:01:05-05 57 66 Credit is provided by domestic banks, all other sectors of the economy and non-residents. The “private non-financial sector” includes non-financial corporations (both private-owned and public-owned), households and non-profit institutions serving households as defined in the System of National Accounts 2008. The series have quarterly frequency and capture the outstanding amount of credit at the end of the reference quarter. In terms of financial instruments, credit covers loans and debt securities.(1) The combination of different sources and data from various methodological frameworks resulted in breaks in the series. The BIS is therefore, in addition, publishing a second set of series adjusted for breaks, which covers the same time span as the unadjusted series. The break-adjusted series are the result of the BIS’s own calculations, and were obtained by adjusting levels through standard statistical techniques described in the special feature on the long credit series of the March 2013 issue of the BIS Quarterly Review at https://www.bis.org/publ/qtrpdf/r_qt1303h.htm. (1) Source Code: Q:US:P:A:M:770:A (1) Bank for International Settlements. “Long series on credit to private non-financial ://www.bis.org/statistics/credtopriv.htm Copyright, 2016, Bank for International Settlements (BIS). Terms and conditions of use are available at http://www.bis.org/terms_conditions.htm#Copyright_and_Permissions. Unless otherwise specified, series values are market values.
PCESV 2018-12-09 2018-12-09 Personal Consumption Expenditures: Services 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:05-06 57 60 BEA Account Code: DSERRC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
NETFI 2018-12-09 2018-12-09 Balance on Current Account, NIPA’s 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 57 57 BEA Account Code: A124RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
M318501A027NBEA 2018-12-09 2018-12-09 Federal government budget surplus or deficit (-) 1952-01-01 2016-01-01 Annual A Billions of Dollars Bil. of $ Not Seasonally Adjusted NSA 2017-11-20 14:01:02-06 57 61 BEA Account Code: M318501 For more information about this series, please see http://www.bea.gov/national/.
NAEXKP01CAQ189S 2018-12-09 2018-12-09 Gross Domestic Product by Expenditure in Constant Prices: Total Gross Domestic Product for Canada 1961-01-01 2018-04-01 Quarterly Q National Currency National Currency Seasonally Adjusted SA 2018-09-13 15:11:07-05 56 62 OECD descriptor ID: NAEXKP01 OECD unit ID: STSA OECD country ID: CAN All OECD data should be cited as follows: OECD, “Main Economic Indicators - complete database”, Main Economic Indicators (database),http://dx.doi.org/10.1787/data-00052-en (Accessed on date) Copyright, 2016, OECD. Reprinted with permission.
PCECTPI 2018-12-09 2018-12-09 Personal Consumption Expenditures: Chain-type Price Index 1947-01-01 2018-07-01 Quarterly Q Index 2012=100 Index 2012=100 Seasonally Adjusted SA 2018-11-28 07:51:04-06 56 77 BEA Account Code: DPCERG A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
CARGSP 2018-12-09 2018-12-09 Real Total Gross Domestic Product for California 1997-01-01 2017-01-01 Annual A Millions of Chained 2012 Dollars Mil. of Chn. 2012 $ Not Seasonally Adjusted NSA 2018-11-19 16:07:36-06 56 56 NA
A091RC1Q027SBEA 2018-12-09 2018-12-09 Federal government current expenditures: Interest payments 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:06-06 56 56 BEA Account Code: A091RC For more information about this series, please see http://www.bea.gov/national/.
IMPGSC1 2018-12-09 2018-12-09 Real imports of goods and services 1947-01-01 2018-07-01 Quarterly Q Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:05-06 55 66 BEA Account Code: A021RX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
CLVMNACSCAB1GQIT 2018-12-09 2018-12-09 Real Gross Domestic Product for Italy 1995-01-01 2018-07-01 Quarterly Q Millions of Chained 2010 Euros Mil. of Chn. 2010 Euros Seasonally Adjusted SA 2018-12-07 10:01:03-06 55 56 Eurostat unit ID: CLV10_MNAC Eurostat item ID = B1GQ Eurostat country ID: IT Seasonally and calendar adjusted data. For euro area member states, the national currency series are converted into euros using the irrevocably fixed exchange rate. This preserves the same growth rates than for the previous national currency series. Both series coincide for years after accession to the euro area but differ for earlier years due to market exchange rate movements. Copyright, European Union, http://ec.europa.eu, 1995-2016.Complete terms of use are available at http://ec.europa.eu/geninfo/legal_notices_en.htm#copyright
EXPGSCA 2018-12-09 2018-12-09 Real Exports of Goods and Services 1929-01-01 2017-01-01 Annual A Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Not Seasonally Adjusted NSA 2018-07-27 10:32:57-05 55 67 BEA Account Code: A020RX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
DPIC96 2018-12-09 2018-12-09 Real Disposable Personal Income 1947-01-01 2018-07-01 Quarterly Q Billions of Chained 2012 Dollars Bil. of Chn. 2012 $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:05-06 55 77 BEA Account Code: A067RX A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
BOEBSTAUKA 2018-12-09 2018-12-09 Bank of England Balance Sheet - Total Assets in the United Kingdom 1701-01-01 2016-01-01 Annual, As of February A Percent of Nominal GDP % of Nominal GDP Not Seasonally Adjusted NSA 2018-03-12 07:51:01-05 54 54 This measure uses a lagged break-adjusted measure of nominal GDP as the denominator. This series was constructed by the Bank of England as part of the Three Centuries of Macroeconomic Data project by combining data from a number of academic and official sources. For more information, please refer to the Three Centuries spreadsheet at http://www.bankofengland.co.uk/research/Pages/onebank/threecenturies.aspx. Users are advised to check the underlying assumptions behind this series in the relevant worksheets of the spreadsheet. In many cases alternative assumptions might be appropriate. Users are permitted to reproduce this series in their own work as it represents Bank calculations and manipulations of underlying series that are the copyright of the Bank of England provided that underlying sources are cited appropriately. For appropriate citation please see the Three Centuries spreadsheet for guidance and a list of the underlying sources.
GGSAVE 2018-12-09 2018-12-09 Gross Government Saving 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:06-06 54 55 BEA Account Code: A927RC
A939RC0A052NBEA 2018-12-09 2018-12-09 Gross domestic product per capita 1929-01-01 2017-01-01 Annual A Dollars $ Not Seasonally Adjusted NSA 2018-07-27 10:32:55-05 54 58 BEA Account Code: A939RC For more information about this series, please see http://www.bea.gov/national/.
FGRECPT 2018-12-09 2018-12-09 Federal Government Current Receipts 1947-01-01 2018-07-01 Quarterly Q Billions of Dollars Bil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-28 07:51:04-06 54 54 BEA Account Code: W005RC A Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
CLVMNACSCAB1GQFR 2018-12-09 2018-12-09 Real Gross Domestic Product for France 1975-01-01 2018-07-01 Quarterly Q Millions of Chained 2010 Euros Mil. of Chn. 2010 Euros Seasonally Adjusted SA 2018-12-07 10:01:03-06 54 55 Eurostat unit ID: CLV10_MNAC Eurostat item ID = B1GQ Eurostat country ID: FR Seasonally and calendar adjusted data. For euro area member states, the national currency series are converted into euros using the irrevocably fixed exchange rate. This preserves the same growth rates than for the previous national currency series. Both series coincide for years after accession to the euro area but differ for earlier years due to market exchange rate movements. Copyright, European Union, http://ec.europa.eu, 1995-2016.Complete terms of use are available at http://ec.europa.eu/geninfo/legal_notices_en.htm#copyright
DPCERE1Q156NBEA 2018-12-09 2018-12-09 Shares of gross domestic product: Personal consumption expenditures 1947-01-01 2018-07-01 Quarterly Q Percent % Not Seasonally Adjusted NSA 2018-11-28 07:51:05-06 54 55 BEA Account Code: DPCERE For more information about this series, please see http://www.bea.gov/national/.
GOAI 2018-12-09 2018-12-09 Gross Output of All Industries 2005-01-01 2018-04-01 Quarterly Q Millions of Dollars Mil. of $ Seasonally Adjusted Annual Rate SAAR 2018-11-01 16:52:25-05 54 54 According to the source, gross output is a measure of an industry’s sales or receipts, which can include sales to final users in the economy (GDP) or sales to other industries (intermediate inputs).
NYGDPPCAPKDCHN 2018-12-09 2018-12-09 Constant GDP per capita for China 1960-01-01 2017-01-01 Annual A 2010 U.S. Dollars 2010 U.S. $ Not Seasonally Adjusted NSA 2018-07-20 08:32:02-05 54 54 GDP per capita is gross domestic product divided by midyear population. GDP is the sum of gross value added by all resident producers in the economy plus any product taxes and minus any subsidies not included in the value of the products. It is calculated without making deductions for depreciation of fabricated assets or for depletion and degradation of natural resources. World Bank national accounts data, and OECD National Accounts data files.
DDDM01CNA156NWDB 2018-12-09 2018-12-09 Stock Market Capitalization to GDP for China 1992-01-01 2017-01-01 Annual A Percent % Not Seasonally Adjusted NSA 2018-09-21 11:21:02-05 54 54 Total value of all listed shares in a stock market as a percentage of GDP. Value of listed shares to GDP, calculated using the following deflation method: {(0.5)*[Ft/P_et + Ft-1/P_et-1]}/[GDPt/P_at] where F is stock market capitalization, P_e is end-of period CPI, and P_a is average annual CPI. End-of period CPI (IFS line 64M..ZF or, if not available, 64Q..ZF) and annual CPI (IFS line 64..ZF) are from the IMF’s International Financial Statistics. Standard & Poor’s, Global Stock Markets Factbook and supplemental S&P data) Source Code: GFDD.DM.01
GDPC1CTM 2018-12-09 2018-12-09 FOMC Summary of Economic Projections for the Growth Rate of Real Gross Domestic Product, Central Tendency, Midpoint 2018-01-01 2021-01-01 Annual A Fourth Quarter to Fourth Quarter Percent Change Fourth Qtr. to Fourth Qtr. % Chg. Not Seasonally Adjusted NSA 2018-09-26 17:11:01-05 53 53 Projections of real gross domestic product growth are fourth-quarter growth rates, that is, percentage changes from the fourth quarter of the prior year to the fourth quarter of the indicated year. Each participant’s projections are based on his or her assessment of appropriate monetary policy. The range for each variable in a given year includes all participants’ projections, from lowest to highest, for that variable in the given year; the central tendencies exclude the three highest and three lowest projections for each year. This series represents the midpoint of the central tendency forecast’s high and low values established by the Federal Open Market Committee. Digitized originals of this release can be found at https://fraser.stlouisfed.org/publication/?pid=677.
CLVMEURSCAB1GQEA19 2018-12-09 2018-12-09 Real Gross Domestic Product (Euro/ECU series) for Euro area (19 countries) 1995-01-01 2018-07-01 Quarterly Q Millions of Chained 2010 Euros Mil. of Chn. 2010 Euros Seasonally Adjusted SA 2018-12-07 10:01:03-06 53 54 Eurostat unit ID: CLV10_MEUR Eurostat item ID = B1GQ Eurostat country ID: EA19 Seasonally and calendar adjusted data. Euro/ECU series is expressed in euro from January 1, 1999 till present. Prior to December 31, 1998, synthetic exchange rate of the national currency to European Community Unit (ECU) is used to adjust for market exchange rate movements. EA19: Austria, Belgium, Finland, France, Germany, Ireland, Italy, Luxembourg, Netherlands, Portugal, Spain, Greece, Slovenia, Cyprus, Malta, Slovakia, Estonia, Latvia, and Lithuania. Copyright, European Union, http://ec.europa.eu, 1995-2016. Complete terms of use are available at http://ec.europa.eu/geninfo/legal_notices_en.htm#copyright
GFDGDPA188S 2018-12-09 2018-12-09 Gross Federal Debt as Percent of Gross Domestic Product 1939-01-01 2017-01-01 Annual A Percent of GDP % of GDP Not Seasonally Adjusted NSA 2018-07-27 16:31:03-05 53 53 Gross Federal Debt as Percent of Gross Domestic Product (GFDGDPA188S) was first constructed by the Federal Reserve Bank of St. Louis in January 2013. It is calculated using Gross Federal Debt (FYGFD) and Gross Domestic Product (GDPA): GFDGDPA188S = (FYGFD/GDPA)*100

From this selection we decide to use two indicators: Gross Domestic Product per Capita and Real Personal Consumption Expenditures.

#Gross domestic product
gdp <- fred$series.observations(series_id = 'A939RX0Q048SBEA')
head(gdp,n=100) %>% kable() %>% kable_styling() %>% scroll_box(height = "400px")
realtime_start realtime_end date value
2018-12-09 2018-12-09 1947-01-01 14203.0
2018-12-09 2018-12-09 1947-04-01 14101.0
2018-12-09 2018-12-09 1947-07-01 14008.0
2018-12-09 2018-12-09 1947-10-01 14161.0
2018-12-09 2018-12-09 1948-01-01 14316.0
2018-12-09 2018-12-09 1948-04-01 14495.0
2018-12-09 2018-12-09 1948-07-01 14515.0
2018-12-09 2018-12-09 1948-10-01 14464.0
2018-12-09 2018-12-09 1949-01-01 14202.0
2018-12-09 2018-12-09 1949-04-01 14098.0
2018-12-09 2018-12-09 1949-07-01 14182.0
2018-12-09 2018-12-09 1949-10-01 13999.0
2018-12-09 2018-12-09 1950-01-01 14490.0
2018-12-09 2018-12-09 1950-04-01 14879.0
2018-12-09 2018-12-09 1950-07-01 15388.0
2018-12-09 2018-12-09 1950-10-01 15612.0
2018-12-09 2018-12-09 1951-01-01 15759.0
2018-12-09 2018-12-09 1951-04-01 15968.0
2018-12-09 2018-12-09 1951-07-01 16223.0
2018-12-09 2018-12-09 1951-10-01 16181.0
2018-12-09 2018-12-09 1952-01-01 16288.0
2018-12-09 2018-12-09 1952-04-01 16259.0
2018-12-09 2018-12-09 1952-07-01 16306.0
2018-12-09 2018-12-09 1952-10-01 16765.0
2018-12-09 2018-12-09 1953-01-01 17013.0
2018-12-09 2018-12-09 1953-04-01 17082.0
2018-12-09 2018-12-09 1953-07-01 16908.0
2018-12-09 2018-12-09 1953-10-01 16574.0
2018-12-09 2018-12-09 1954-01-01 16425.0
2018-12-09 2018-12-09 1954-04-01 16376.0
2018-12-09 2018-12-09 1954-07-01 16485.0
2018-12-09 2018-12-09 1954-10-01 16726.0
2018-12-09 2018-12-09 1955-01-01 17132.0
2018-12-09 2018-12-09 1955-04-01 17341.0
2018-12-09 2018-12-09 1955-07-01 17496.0
2018-12-09 2018-12-09 1955-10-01 17516.0
2018-12-09 2018-12-09 1956-01-01 17376.0
2018-12-09 2018-12-09 1956-04-01 17449.0
2018-12-09 2018-12-09 1956-07-01 17352.0
2018-12-09 2018-12-09 1956-10-01 17550.0
2018-12-09 2018-12-09 1957-01-01 17583.0
2018-12-09 2018-12-09 1957-04-01 17473.0
2018-12-09 2018-12-09 1957-07-01 17566.0
2018-12-09 2018-12-09 1957-10-01 17305.0
2018-12-09 2018-12-09 1958-01-01 16793.0
2018-12-09 2018-12-09 1958-04-01 16839.0
2018-12-09 2018-12-09 1958-07-01 17154.0
2018-12-09 2018-12-09 1958-10-01 17475.0
2018-12-09 2018-12-09 1959-01-01 17734.0
2018-12-09 2018-12-09 1959-04-01 18064.0
2018-12-09 2018-12-09 1959-07-01 18000.0
2018-12-09 2018-12-09 1959-10-01 17972.0
2018-12-09 2018-12-09 1960-01-01 18268.0
2018-12-09 2018-12-09 1960-04-01 18060.0
2018-12-09 2018-12-09 1960-07-01 18059.0
2018-12-09 2018-12-09 1960-10-01 17756.0
2018-12-09 2018-12-09 1961-01-01 17816.0
2018-12-09 2018-12-09 1961-04-01 18049.0
2018-12-09 2018-12-09 1961-07-01 18319.0
2018-12-09 2018-12-09 1961-10-01 18598.0
2018-12-09 2018-12-09 1962-01-01 18863.0
2018-12-09 2018-12-09 1962-04-01 18967.0
2018-12-09 2018-12-09 1962-07-01 19126.0
2018-12-09 2018-12-09 1962-10-01 19111.0
2018-12-09 2018-12-09 1963-01-01 19257.0
2018-12-09 2018-12-09 1963-04-01 19410.0
2018-12-09 2018-12-09 1963-07-01 19761.0
2018-12-09 2018-12-09 1963-10-01 19814.0
2018-12-09 2018-12-09 1964-01-01 20169.0
2018-12-09 2018-12-09 1964-04-01 20324.0
2018-12-09 2018-12-09 1964-07-01 20567.0
2018-12-09 2018-12-09 1964-10-01 20558.0
2018-12-09 2018-12-09 1965-01-01 20997.0
2018-12-09 2018-12-09 1965-04-01 21205.0
2018-12-09 2018-12-09 1965-07-01 21604.0
2018-12-09 2018-12-09 1965-10-01 22030.0
2018-12-09 2018-12-09 1966-01-01 22510.0
2018-12-09 2018-12-09 1966-04-01 22528.0
2018-12-09 2018-12-09 1966-07-01 22650.0
2018-12-09 2018-12-09 1966-10-01 22766.0
2018-12-09 2018-12-09 1967-01-01 22911.0
2018-12-09 2018-12-09 1967-04-01 22869.0
2018-12-09 2018-12-09 1967-07-01 23020.0
2018-12-09 2018-12-09 1967-10-01 23129.0
2018-12-09 2018-12-09 1968-01-01 23551.0
2018-12-09 2018-12-09 1968-04-01 23889.0
2018-12-09 2018-12-09 1968-07-01 24009.0
2018-12-09 2018-12-09 1968-10-01 24039.0
2018-12-09 2018-12-09 1969-01-01 24365.0
2018-12-09 2018-12-09 1969-04-01 24383.0
2018-12-09 2018-12-09 1969-07-01 24475.0
2018-12-09 2018-12-09 1969-10-01 24284.0
2018-12-09 2018-12-09 1970-01-01 24189.0
2018-12-09 2018-12-09 1970-04-01 24148.0
2018-12-09 2018-12-09 1970-07-01 24288.0
2018-12-09 2018-12-09 1970-10-01 23945.0
2018-12-09 2018-12-09 1971-01-01 24520.0
2018-12-09 2018-12-09 1971-04-01 24581.0
2018-12-09 2018-12-09 1971-07-01 24707.0
2018-12-09 2018-12-09 1971-10-01 24689.0
#Real Personal Consumption Expenditures
rpce <- fred$series.observations(series_id = 'DPCERL1Q225SBEA')
head(rpce,n=100) %>% kable() %>% kable_styling() %>% scroll_box(height = "400px")
realtime_start realtime_end date value
2018-12-09 2018-12-09 1947-04-01 6.8
2018-12-09 2018-12-09 1947-07-01 1.3
2018-12-09 2018-12-09 1947-10-01 0.1
2018-12-09 2018-12-09 1948-01-01 2
2018-12-09 2018-12-09 1948-04-01 4.7
2018-12-09 2018-12-09 1948-07-01 0.6
2018-12-09 2018-12-09 1948-10-01 3.2
2018-12-09 2018-12-09 1949-01-01 0.7
2018-12-09 2018-12-09 1949-04-01 6.3
2018-12-09 2018-12-09 1949-07-01 0.9
2018-12-09 2018-12-09 1949-10-01 6
2018-12-09 2018-12-09 1950-01-01 6.8
2018-12-09 2018-12-09 1950-04-01 6.8
2018-12-09 2018-12-09 1950-07-01 22.2
2018-12-09 2018-12-09 1950-10-01 -11.5
2018-12-09 2018-12-09 1951-01-01 10
2018-12-09 2018-12-09 1951-04-01 -10.8
2018-12-09 2018-12-09 1951-07-01 4.7
2018-12-09 2018-12-09 1951-10-01 2.4
2018-12-09 2018-12-09 1952-01-01 0.9
2018-12-09 2018-12-09 1952-04-01 8.0
2018-12-09 2018-12-09 1952-07-01 1.9
2018-12-09 2018-12-09 1952-10-01 14.9
2018-12-09 2018-12-09 1953-01-01 4.8
2018-12-09 2018-12-09 1953-04-01 2.4
2018-12-09 2018-12-09 1953-07-01 -1.0
2018-12-09 2018-12-09 1953-10-01 -2.7
2018-12-09 2018-12-09 1954-01-01 1.5
2018-12-09 2018-12-09 1954-04-01 5.3
2018-12-09 2018-12-09 1954-07-01 5.5
2018-12-09 2018-12-09 1954-10-01 8.7
2018-12-09 2018-12-09 1955-01-01 9.3
2018-12-09 2018-12-09 1955-04-01 7.9
2018-12-09 2018-12-09 1955-07-01 5
2018-12-09 2018-12-09 1955-10-01 5.1
2018-12-09 2018-12-09 1956-01-01 0.6
2018-12-09 2018-12-09 1956-04-01 1.3
2018-12-09 2018-12-09 1956-07-01 0.9
2018-12-09 2018-12-09 1956-10-01 5.6
2018-12-09 2018-12-09 1957-01-01 2.8
2018-12-09 2018-12-09 1957-04-01 0.7
2018-12-09 2018-12-09 1957-07-01 3.2
2018-12-09 2018-12-09 1957-10-01 0.2
2018-12-09 2018-12-09 1958-01-01 -5.4
2018-12-09 2018-12-09 1958-04-01 3.3
2018-12-09 2018-12-09 1958-07-01 6.8
2018-12-09 2018-12-09 1958-10-01 5.5
2018-12-09 2018-12-09 1959-01-01 7.5
2018-12-09 2018-12-09 1959-04-01 6.3
2018-12-09 2018-12-09 1959-07-01 4.2
2018-12-09 2018-12-09 1959-10-01 0.5
2018-12-09 2018-12-09 1960-01-01 3.9
2018-12-09 2018-12-09 1960-04-01 5.2
2018-12-09 2018-12-09 1960-07-01 -1.6
2018-12-09 2018-12-09 1960-10-01 0.5
2018-12-09 2018-12-09 1961-01-01 -0.1
2018-12-09 2018-12-09 1961-04-01 6.1
2018-12-09 2018-12-09 1961-07-01 2
2018-12-09 2018-12-09 1961-10-01 8.3
2018-12-09 2018-12-09 1962-01-01 4.3
2018-12-09 2018-12-09 1962-04-01 5
2018-12-09 2018-12-09 1962-07-01 3.2
2018-12-09 2018-12-09 1962-10-01 5.8
2018-12-09 2018-12-09 1963-01-01 2.8
2018-12-09 2018-12-09 1963-04-01 3.8
2018-12-09 2018-12-09 1963-07-01 5.5
2018-12-09 2018-12-09 1963-10-01 3.4
2018-12-09 2018-12-09 1964-01-01 8.1
2018-12-09 2018-12-09 1964-04-01 7.3
2018-12-09 2018-12-09 1964-07-01 7.6
2018-12-09 2018-12-09 1964-10-01 1.1
2018-12-09 2018-12-09 1965-01-01 9.2
2018-12-09 2018-12-09 1965-04-01 4.5
2018-12-09 2018-12-09 1965-07-01 7.0
2018-12-09 2018-12-09 1965-10-01 11.7
2018-12-09 2018-12-09 1966-01-01 6
2018-12-09 2018-12-09 1966-04-01 1
2018-12-09 2018-12-09 1966-07-01 4.7
2018-12-09 2018-12-09 1966-10-01 1.7
2018-12-09 2018-12-09 1967-01-01 2.3
2018-12-09 2018-12-09 1967-04-01 5.6
2018-12-09 2018-12-09 1967-07-01 2.1
2018-12-09 2018-12-09 1967-10-01 2.5
2018-12-09 2018-12-09 1968-01-01 9.9
2018-12-09 2018-12-09 1968-04-01 6.2
2018-12-09 2018-12-09 1968-07-01 7.7
2018-12-09 2018-12-09 1968-10-01 1.8
2018-12-09 2018-12-09 1969-01-01 4.5
2018-12-09 2018-12-09 1969-04-01 2.6
2018-12-09 2018-12-09 1969-07-01 2.0
2018-12-09 2018-12-09 1969-10-01 3.2
2018-12-09 2018-12-09 1970-01-01 2.5
2018-12-09 2018-12-09 1970-04-01 1.8
2018-12-09 2018-12-09 1970-07-01 3.5
2018-12-09 2018-12-09 1970-10-01 -1.1
2018-12-09 2018-12-09 1971-01-01 7.9
2018-12-09 2018-12-09 1971-04-01 3.7
2018-12-09 2018-12-09 1971-07-01 3.2
2018-12-09 2018-12-09 1971-10-01 6.8
2018-12-09 2018-12-09 1972-01-01 5.4

Electoral Data

For this analysis we will need data showing the number of congress and senate seats occupied by both parties. This data was scrapped from The University of Wisconsin’s web page.

url <- "https://web.education.wisc.edu/nwhillman/index.php/2017/02/01/party-control-in-congress-and-state-legislatures/"
congress_by_party <- url %>%
  read_html() %>%
  html_table()
# this is wide format . 
congress_by_party <- congress_by_party[[1]]
head(congress_by_party,n=100) %>% kable() %>% kable_styling() %>% scroll_box(height = "400px")
X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
NA Senate Senate Senate House House House State Legislatures State Legislatures State Legislatures
NA Dem Rep Oth Dem Rep Oth Dem Rep Split+NE
1978 58 41 1 277 158 0 31 11 8
1980 46 53 1 242 192 1 28 15 7
1982 46 54 0 269 166 0 34 10 6
1984 47 53 0 253 182 0 28 10 12
1986 55 45 0 258 177 0 27 9 14
1988 55 45 0 260 175 0 29 8 13
1990 56 44 0 267 167 1 29 6 15
1992 57 43 0 258 176 1 26 7 17
1994 48 52 0 204 230 1 22 15 13
1996 45 55 0 207 226 2 20 17 13
1998 45 55 0 211 223 1 20 17 13
2000 50 50 0 212 221 2 16 18 16
2002 48 51 1 205 229 1 16 21 13
2004 44 55 1 202 231 2 19 20 11
2006 49 49 2 233 198 4 23 16 11
2008 57 41 2 256 178 1 27 14 9
2010 51 47 2 193 242 0 27 14 9
2012 54 45 1 201 234 0 15 27 8
2014 44 54 2 188 246 1 19 26 5
2016 46 52 2 194 241 0 14 32 4

Tidy & Transform

Economic Indicators Dataset

Since our analysis will be annual based, as senate and congress seats change biannually, the economic data gathered from the Federal Reserve site needs to be scaled up from quarterly to annually.

#Scale up data from quarterly to annual
gdp$date<-substring(gdp$date,1,4)
gdp$date<-as.numeric(gdp$date)
gdp$value<-as.numeric(gdp$value)
gdp$value<-gdp$value/4
gdp<-gdp %>% group_by(date) %>% summarise(value=sum(value))
gdp <- gdp %>% mutate(Diff = (value - lag(value))/lag(value)) # we add a column for the GDP difference between each year

rpce$date<-substring(rpce$date,1,4)
rpce$date<-as.numeric(rpce$date)
rpce$value<-as.numeric(rpce$value)
rpce$value<-rpce$value/4
rpce<-rpce %>% group_by(date) %>% summarise(value=sum(value))

Final Economic Indicators Dataset

gdp %>% kable() %>% kable_styling() %>% scroll_box(height = "400px")
date value Diff
1947 14118.25 NA
1948 14447.50 0.0233209
1949 14120.25 -0.0226510
1950 15092.25 0.0688373
1951 16032.75 0.0623168
1952 16404.50 0.0231869
1953 16894.25 0.0298546
1954 16503.00 -0.0231588
1955 17371.25 0.0526116
1956 17431.75 0.0034828
1957 17481.75 0.0028683
1958 17065.25 -0.0238248
1959 17942.50 0.0514056
1960 18035.75 0.0051972
1961 18195.50 0.0088574
1962 19016.75 0.0451348
1963 19560.50 0.0285932
1964 20404.50 0.0431482
1965 21459.00 0.0516798
1966 22613.50 0.0538003
1967 22982.25 0.0163066
1968 23872.00 0.0387147
1969 24376.75 0.0211440
1970 24142.50 -0.0096096
1971 24624.25 0.0199544
1972 25642.75 0.0413617
1973 26834.25 0.0464654
1974 26445.50 -0.0144871
1975 26134.75 -0.0117506
1976 27277.50 0.0437253
1977 28253.25 0.0357712
1978 29503.25 0.0442427
1979 30104.00 0.0203622
1980 29681.75 -0.0140264
1981 30132.75 0.0151945
1982 29308.00 -0.0273706
1983 30372.75 0.0363297
1984 32287.75 0.0630499
1985 33336.25 0.0324736
1986 34178.75 0.0252728
1987 35046.50 0.0253886
1988 36180.00 0.0323427
1989 37156.50 0.0269900
1990 37435.50 0.0075088
1991 36900.00 -0.0143046
1992 37694.75 0.0215379
1993 38233.00 0.0142792
1994 39294.00 0.0277509
1995 39875.00 0.0147860
1996 40898.75 0.0256740
1997 42210.00 0.0320609
1998 43591.00 0.0327174
1999 45144.25 0.0356324
2000 46497.25 0.0299706
2001 46497.00 -0.0000054
2002 46858.00 0.0077639
2003 47754.50 0.0191323
2004 49123.50 0.0286675
2005 50380.75 0.0255937
2006 51329.50 0.0188316
2007 51793.50 0.0090396
2008 51241.25 -0.0106625
2009 49501.00 -0.0339619
2010 50351.25 0.0171764
2011 50755.00 0.0080187
2012 51521.50 0.0151020
2013 52101.50 0.0112574
2014 52984.00 0.0169381
2015 54109.75 0.0212470
2016 54559.25 0.0083072
2017 55372.50 0.0149058
2018 42308.50 -0.2359294
rpce %>% kable() %>% kable_styling() %>% scroll_box(height = "400px")
date value
1947 2.050
1948 2.625
1949 3.475
1950 6.075
1951 1.575
1952 6.425
1953 0.875
1954 5.250
1955 6.825
1956 2.100
1957 1.725
1958 2.550
1959 4.625
1960 2.000
1961 4.075
1962 4.575
1963 3.875
1964 6.025
1965 8.100
1966 3.350
1967 3.125
1968 6.400
1969 3.075
1970 1.675
1971 5.400
1972 7.300
1973 1.875
1974 -1.500
1975 5.075
1976 5.375
1977 4.250
1978 4.025
1979 1.700
1980 0.175
1981 0.125
1982 3.525
1983 6.575
1984 4.350
1985 4.850
1986 4.425
1987 2.875
1988 4.625
1989 2.375
1990 0.800
1991 0.925
1992 4.925
1993 3.325
1994 3.825
1995 2.775
1996 3.425
1997 4.500
1998 5.625
1999 5.125
2000 4.425
2001 2.500
2002 2.125
2003 3.800
2004 3.750
2005 3.025
2006 3.200
2007 1.600
2008 -1.800
2009 -0.075
2010 2.675
2011 1.225
2012 1.600
2013 1.875
2014 3.800
2015 3.025
2016 2.775
2017 2.700
2018 1.975

Adding dataset to Mongo database

InsertRecords<- function(data, collectionName) {
  data607_final_project <- mongo( db = "DATA607", collection = collectionName)
  x <-data607_final_project$insert(data)
  rm(data607_final_project)
  gc()
  x
}

InsertRecords(gdp, 'gdp')
## List of 5
##  $ nInserted  : num 72
##  $ nMatched   : num 0
##  $ nRemoved   : num 0
##  $ nUpserted  : num 0
##  $ writeErrors: list()
InsertRecords(rpce, 'rpce')
## List of 5
##  $ nInserted  : num 72
##  $ nMatched   : num 0
##  $ nRemoved   : num 0
##  $ nUpserted  : num 0
##  $ writeErrors: list()

Electoral Dataset

For our analysis, electoral data is taken into a long table format from its original wide table format in the University’s website.

# conver to long format. year, party, chamber, seats
congress_by_party  <- congress_by_party %>% select(1:7)
 
names(congress_by_party) <- c('date',
                              paste(congress_by_party[1,2], congress_by_party[2,2]),
                              paste(congress_by_party[1,3], congress_by_party[2,3]),
                              paste(congress_by_party[1,4], congress_by_party[2,4]),
                              paste(congress_by_party[1,5], congress_by_party[2,5]),
                              paste(congress_by_party[1,6], congress_by_party[2,6]),
                              paste(congress_by_party[1,7], congress_by_party[2,7])
                              )
congress_by_party <- congress_by_party %>%
                    mutate(Senate =ifelse(congress_by_party$`Senate Dem` > congress_by_party$`Senate Rep`, "Dem", ifelse(congress_by_party$`Senate Dem` == congress_by_party$`Senate Rep`, 'Hung','Rep')))

congress_by_party <- congress_by_party %>%
                    mutate(House =ifelse(congress_by_party$`House Dem` > congress_by_party$`House Rep`, "Dem", ifelse(congress_by_party$`House Dem` == congress_by_party$`House Rep`, 'Hung','Rep')))

congress_by_party<- congress_by_party[c(3:22),] %>% arrange(desc(date))

congress_by_party$date <- as.numeric(congress_by_party$date)
 
#Fill int the data for the year between elections
congress_by_party_between_years <- congress_by_party

congress_by_party_between_years$date <-congress_by_party_between_years$date+1

congress <- rbind(congress_by_party, congress_by_party_between_years)

congress<- congress %>% arrange(desc(date))

Final Electoral Dataset

 congress %>% kable() %>% kable_styling() %>% scroll_box(height = "400px")
date Senate Dem Senate Rep Senate Oth House Dem House Rep House Oth Senate House
2017 46 52 2 194 241 0 Rep Rep
2016 46 52 2 194 241 0 Rep Rep
2015 44 54 2 188 246 1 Rep Rep
2014 44 54 2 188 246 1 Rep Rep
2013 54 45 1 201 234 0 Dem Rep
2012 54 45 1 201 234 0 Dem Rep
2011 51 47 2 193 242 0 Dem Rep
2010 51 47 2 193 242 0 Dem Rep
2009 57 41 2 256 178 1 Dem Dem
2008 57 41 2 256 178 1 Dem Dem
2007 49 49 2 233 198 4 Hung Dem
2006 49 49 2 233 198 4 Hung Dem
2005 44 55 1 202 231 2 Rep Rep
2004 44 55 1 202 231 2 Rep Rep
2003 48 51 1 205 229 1 Rep Rep
2002 48 51 1 205 229 1 Rep Rep
2001 50 50 0 212 221 2 Hung Rep
2000 50 50 0 212 221 2 Hung Rep
1999 45 55 0 211 223 1 Rep Rep
1998 45 55 0 211 223 1 Rep Rep
1997 45 55 0 207 226 2 Rep Rep
1996 45 55 0 207 226 2 Rep Rep
1995 48 52 0 204 230 1 Rep Rep
1994 48 52 0 204 230 1 Rep Rep
1993 57 43 0 258 176 1 Dem Dem
1992 57 43 0 258 176 1 Dem Dem
1991 56 44 0 267 167 1 Dem Dem
1990 56 44 0 267 167 1 Dem Dem
1989 55 45 0 260 175 0 Dem Dem
1988 55 45 0 260 175 0 Dem Dem
1987 55 45 0 258 177 0 Dem Dem
1986 55 45 0 258 177 0 Dem Dem
1985 47 53 0 253 182 0 Rep Dem
1984 47 53 0 253 182 0 Rep Dem
1983 46 54 0 269 166 0 Rep Dem
1982 46 54 0 269 166 0 Rep Dem
1981 46 53 1 242 192 1 Rep Dem
1980 46 53 1 242 192 1 Rep Dem
1979 58 41 1 277 158 0 Dem Dem
1978 58 41 1 277 158 0 Dem Dem

Adding dataset to Mongo database

InsertRecords(congress, 'congress')
## List of 5
##  $ nInserted  : num 40
##  $ nMatched   : num 0
##  $ nRemoved   : num 0
##  $ nUpserted  : num 0
##  $ writeErrors: list()

Read data from Mongo

mongoCongress <- mongo( db = "DATA607", collection = "congress")
congress <- mongoCongress$find('{}')

mongoGdp <- mongo( db = "DATA607", collection = "gdp")
gdp <- mongoGdp$find('{}')


mongoRcpe <- mongo( db = "DATA607", collection = "rpce")
rpce <- mongoRcpe$find('{}')

Visualize

GDP Data

As can be seen below, the GDP per capita is a value that increases over time. GDP is dependent on population, but also on other factors such as inflation.

plot(gdp$date,gdp$value)

For our analysis we will use the difference in GDP year over year, normalized over the previous value of GDP. This is that is calculated in the datasets Diff column

plot(gdp$date,gdp$Diff)

gdp_congress<-gdp
gdp_congress$date <- as.numeric(gdp_congress$date) 
gdp_congress$Diff <- as.double(gdp_congress$Diff)

 
gdp_congress <- gdp_congress%>%inner_join(congress)
## Joining, by = "date"
ggplot(gdp_congress, aes(x=date, y=Diff, shape=House, color=House)) +
  geom_point()

ggplot(gdp_congress, aes(x=date, y=Diff, shape=Senate, color=Senate)) +
  geom_point() 

**RPCE Data*

plot(rpce$date,rpce$value)

rpce_congress<-rpce
rpce_congress$date <- as.numeric(rpce_congress$date) 
rpce_congress$value <- as.double(rpce_congress$value)

 
rpce_congress <- rpce_congress%>%inner_join(congress)
## Joining, by = "date"
ggplot(rpce_congress, aes(x=date, y=value, shape=House, color=House)) +
  geom_point()

ggplot(rpce_congress, aes(x=date, y=value, shape=Senate, color=Senate)) +
  geom_point() 

Model

Economic Indicator Predictor

GDP Models

A simple model can determine the expected GDP normilized difference year on year value for a year where the Democratic or Republican party is majority in each chamber.

House controlled by the Democratic Party

gdp_congress_house_dem<-subset(gdp_congress,gdp_congress$House=="Dem")
mean(gdp_congress_house_dem$Diff)
## [1] 0.0146259

House controlled by the Republican Party

gdp_congress_house_rep<-subset(gdp_congress,gdp_congress$House=="Rep")
mean(gdp_congress_house_rep$Diff)
## [1] 0.01963483

Senate controlled by the Democratic Party

gdp_congress_senate_dem<-subset(gdp_congress,gdp_congress$Senate=="Dem")
mean(gdp_congress_senate_dem$Diff)
## [1] 0.0131594

Senate controlled by the Republican Party

gdp_congress_senate_rep<-subset(gdp_congress,gdp_congress$Senate=="Rep")
mean(gdp_congress_senate_rep$Diff)
## [1] 0.02084138

Senate controlled by the Republican Party and House by the Democratic Party

gdp_congress_senate_rep_house_dem<-subset(gdp_congress,rpce_congress$Senate=="Rep" & gdp_congress$House=="Dem")
mean(gdp_congress_senate_rep_house_dem$Diff)
## [1] 0.01760847

GDP Diff predicted by number of Democratic Party seats in congress

To derive this model we build a linear regression of GDP Diff agaisnt the number of Democratic seats in each chamber.

House

congress_gdp<-inner_join(congress,gdp)
## Joining, by = "date"
congress_gdp$`House Dem`<-as.numeric(congress_gdp$`House Dem`)
gdp_house_model<-lm(Diff ~ `House Dem`,data = congress_gdp)
plot(congress_gdp$`House Dem`,congress_gdp$Diff)
abline(gdp_house_model)

summary(gdp_house_model)
## 
## Call:
## lm(formula = Diff ~ `House Dem`, data = congress_gdp)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.049738 -0.007757  0.001315  0.010454  0.047120 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.885e-02  2.509e-03  11.498  < 2e-16 ***
## `House Dem` -5.109e-05  1.084e-05  -4.711 2.57e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01825 on 3238 degrees of freedom
## Multiple R-squared:  0.006806,   Adjusted R-squared:  0.0065 
## F-statistic: 22.19 on 1 and 3238 DF,  p-value: 2.574e-06

Senate

congress_gdp$`Senate Dem`<-as.numeric(congress_gdp$`Senate Dem`)
gdp_senate_model<-lm(Diff ~ `Senate Dem`,data = congress_gdp)
plot(congress_gdp$`Senate Dem`,congress_gdp$Diff)
abline(gdp_senate_model)

summary(gdp_senate_model)
## 
## Call:
## lm(formula = Diff ~ `Senate Dem`, data = congress_gdp)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.047680 -0.006144  0.000974  0.011724  0.043526 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.0564131  0.0033280   16.95   <2e-16 ***
## `Senate Dem` -0.0007849  0.0000662  -11.86   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01793 on 3238 degrees of freedom
## Multiple R-squared:  0.04161,    Adjusted R-squared:  0.04131 
## F-statistic: 140.6 on 1 and 3238 DF,  p-value: < 2.2e-16

RPCE Models

RPCE prediced by majority Party

A simple model can determine the expected RPCE value for a year where the Democratic or Republican party is majority in each chamber.

House controlled by the Democratic Party

rpce_congress_house_dem<-subset(rpce_congress,rpce_congress$House=="Dem")
mean(rpce_congress_house_dem$value)
## [1] 2.62625

House controlled by the Republican Party

rpce_congress_house_rep<-subset(rpce_congress,rpce_congress$House=="Rep")
mean(rpce_congress_house_rep$value)
## [1] 3.22875

Senate controlled by the Democratic Party

rpce_congress_senate_dem<-subset(rpce_congress,rpce_congress$Senate=="Dem")
mean(rpce_congress_senate_dem$value)
## [1] 2.21875

Senate controlled by the Republican Party

rpce_congress_senate_rep<-subset(rpce_congress,rpce_congress$Senate=="Rep")
mean(rpce_congress_senate_rep$value)
## [1] 3.49375

Senate controlled by the Republican Party and House by the Democratic Party

rpce_congress_senate_rep_house_dem<-subset(rpce_congress,rpce_congress$Senate=="Rep" & rpce_congress$House=="Dem")
mean(rpce_congress_senate_rep_house_dem$value)
## [1] 3.266667

RPCE preditced by number of Democratic Party seats in congress

To derive this model we build a linear regression of RPCE agaisnt the number of Democratic seats in each chamber.

House

congress_rpce<-inner_join(congress,rpce)
## Joining, by = "date"
congress_rpce$`House Dem`<-as.numeric(congress_rpce$`House Dem`)
rpce_house_model<-lm(value ~ `House Dem`,data = congress_rpce)
plot(congress_rpce$`House Dem`,congress_rpce$value)
abline(rpce_house_model)

summary(rpce_house_model)
## 
## Call:
## lm(formula = value ~ `House Dem`, data = congress_rpce)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.6231 -1.0715  0.0245  1.3206  3.8031 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.831807   0.233317  16.423  < 2e-16 ***
## `House Dem` -0.003940   0.001008  -3.908  9.5e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.697 on 3238 degrees of freedom
## Multiple R-squared:  0.004694,   Adjusted R-squared:  0.004387 
## F-statistic: 15.27 on 1 and 3238 DF,  p-value: 9.5e-05

Senate

congress_rpce$`Senate Dem`<-as.numeric(congress_rpce$`Senate Dem`)
rpce_senate_model<-lm(value ~ `Senate Dem`,data = congress_rpce)
plot(congress_rpce$`Senate Dem`,congress_rpce$value)
abline(rpce_senate_model)

summary(rpce_senate_model)
## 
## Call:
## lm(formula = value ~ `Senate Dem`, data = congress_rpce)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.8705 -0.7553 -0.0337  1.0984  3.1481 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   9.099081   0.296345   30.70   <2e-16 ***
## `Senate Dem` -0.123308   0.005894  -20.92   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.597 on 3238 degrees of freedom
## Multiple R-squared:  0.1191, Adjusted R-squared:  0.1188 
## F-statistic: 437.6 on 1 and 3238 DF,  p-value: < 2.2e-16

Modeling Using Python

We experiment with using Python libraries within R. To do this we use the reticulate library. The library was first installed using the command:

install.packages(“reticulate”)

The library was then loaded and the environment on top of which it runs explored. An install of Python was already available in the system, as wells as some Anaconda or conda environments.

#library(reticulate)
#py_discover_config()

The Python library of interest is Scikit-Learn. This library has a regression model which will be used to recreate what was done in R in the previous section to prove Python libraries can be used in RStudio. This library is installed on the environment being used by reticulate using these commands:

conda_install(“r-reticulate”, “scikit-learn”)

Other libraries were also installed:

conda_install(“r-reticulate”, “numpy”) conda_install(“r-reticulate”, “pandas”)

We then load the libraries

As a simple experiment we will use the linear regression functionality in Scikit-Learn to build a model to try to predict the rpce from the number of Democratic seta in the House.

First we look at how we move data from R to Python. We first move the data we will use in the regression to specific variables, and then see those variables in Python using the suffix r.

#R chunk
rpce_house_model<-lm(value ~ `House Dem`,data = congress_rpce)
y<-congress_rpce$value
X<-congress_rpce$'House Dem'

We can now see the R data in a Python chunk

We can now use this data in scikit-learn and build a linear regression model

Results from our regression are also available in R

#R Chunk
#py$coef
#py$inter
#py$error

#plot(X,y)
#abline(py$inter,py$coef)
#title("Python regression plot")

Economy Health Classifier

Classifier in R

Classifier in Python

Communicate

Based on the analysis here presented, this is what we can expect as an economic outlook for next year.

GDP

Since the House will be lead by the Democratic party we expect GDP normilized difference to be around 0.0146259. But since the Senate will be leading the Senate, GDP normilized difference should come at 0.02084138. Since we are looking at a divided congress, expected GDP normilized difference is that for a Senate controlled by Republicans and House by Democrats, which is 0.01760847

RPCE

Since the House will be lead by the Democratic party we expect RPCE to be around 2.62625. But since the Senate will be leading the Senate, RPCE should come at 3.49375. Since we are looking at a divided congress, expected RPCE is that for a Senate controlled by Republicans and House by Democrats, which is 3.266667

Regression Models

An attempt was made to build a model which would predict two economic indicators from the number of seats in the House or Senate a particular party holds. This exercise proved fruitless as a statistically linear model was not possible with the data at hand.

Modeling in Python

Using the R Reticulate library, we are able to use Python packages in RStudio to produce models using data available in R