Gross Domestic Product (GDP) is often thought of and calculated with an Expenditure Approach such that
๐บ๐ท๐=๐ถ+๐ผ+๐บ+(๐โ๐)
where ๐ถ = Consumption, ๐ผ = Investment, ๐บ = Government Spending, & (๐โ๐) = Net Exports.
The United States of America( USA)'s GDP (US GDP) is released quarterly by the Bureau of Economic Analysis, U.S. Department of Commerce. The only aforementioned component of US GDP released on a monthly basis is C, USA's Consumption Data. Monthly figures of GDP figures are thus not available, and estimating such values have proven of interest in academia (Mitchell, Smith, Weale, Wright, and Salazar (2005)) and in practice.
In this article, we will attempt to compute monthly US GDP estimates via the Holt-Winters (HW) method (resources on the HW model can be found here and - for academics - here). We then put ourselves in the shoes of an analyst who only has quarterly GDP component data (C, I, G or (X-M)). She/He uses the latest quarterly releases of GDP component datawhich spans from 2007 (in this study) to last quarter (last month at the earliest). She/He then uses the Holt-Winters method model to compute a forecast for the current period (month).
Accurate monthly GDP figures can be of great use in macroeconomic models going forward.
Development Tools & Resources
The example code demonstrating the use case is based on the following development tools and resources:
- Refinitiv's DataStream Web Services (DSWS): Access to DataStream data. A DataStream or Refinitiv Workspace IDentification (ID) will be needed to run the code bellow.
- Python Environment: Tested with Python 3.7
- Packages: DatastreamDSWS, Numpy, Pandas, statsmodel, scipy and Matplotlib. The Python built in modules warnings, statistics, datetime and dateutil are also required.
Tutorial Video Part 1 - Introduction to the Theory, Codebook and Python Libraries
Import libraries
This code runs on Python version 3.7.4
We need to gather our data. Since Refinitiv's DataStream Web Services (DSWS) allows for access to the most accurate and wholesome end-of-day (EOD) economic database (DB), naturally it is more than appropriate. We can access DSWS via the Python library "DatastreamDSWS" that can be installed simply by using pip install.
We use Refinitiv's Eikon Python Application Programming Interface (API) to access financial data. We can access it via the Python library "eikon" that can be installed simply by using pip install.
The following are Python-built-in module/library, therefore it does not have a specific version number.
statistics, numpy, scipy and statsmodels are needed for datasets' statistical and mathematical manipulations
The numpy library imported in this code is version: 1.16.5
The statsmodels library imported in this code is version: 0.10.1
The scipy library imported in this code is version: 1.3.1
pandas will be needed to manipulate data sets
The pandas library imported in this code is version: 0.25.1
matplotlib is needed to plot graphs of all kinds
The matplotlib library imported in this code is version: 3.1.1
Setup Original Functions
Tutorial Video Part 2 - Introduction to Some Python Fundamentals and Our First Set of Functions
Setup data sets
The cell below defines a function that translates DataStream data into a shape we can work with: a Pandas Dafaframe normalised to the 1st of the month that it was collected in.
The cell below defines a function that appends our monthly data-frame with chosen data
The cell below defines a function to plot data on two y axis.
The cell below defines a function to plot data regressed on time.
Setup Statistics Tools
The cell below defines a function that creates and displays a table of statistics for all vectors (columns) within any two specified datasets.
Monthly Data
U.S.A.'s Consumption Data
Tutorial Video Part 3 - Collect Data and Our Second Set of Functions
Quarterly Data
Tutorial Video Part 4 - Dataframe manipulations and Plots
G.D.P. Component Sum
U.S.A.'s G.D.P.
To check our model, we can use 'United States, National Product Account, Gross Domestic Product, Overall, Total, Current Prices, AR, SA, USD'.
Data Rรฉsumรฉ
Note that the GDP and GDP Component Sum datapoints align so well that they are indistinguishable in the graph above
| Consumption (monthly data) | Investment (quarterly data) | Investment (monthly step data) | Government Investment (quarterly data) | Government Investment (monthly step data) | Net Exports (quarterly data) | Net Exports (monthly step data) | GDP Component Sum (quarterly data) | GDP Component Sum (monthly step data) | GDP (every quarter) | GDP (monthly step data) | |
| 01/02/1950 | NaN | 4.47E+10 | 4.47E+10 | 4.90E+10 | 4.90E+10 | 2.20E+09 | 2.20E+09 | NaN | NaN | 2.81E+11 | 2.81E+11 |
| 01/03/1950 | NaN | NaN | 4.47E+10 | NaN | 4.90E+10 | NaN | 2.20E+09 | NaN | NaN | NaN | 2.81E+11 |
| 01/04/1950 | NaN | NaN | 4.47E+10 | NaN | 4.90E+10 | NaN | 2.20E+09 | NaN | NaN | NaN | 2.81E+11 |
| 01/05/1950 | NaN | 4.95E+10 | 4.95E+10 | 4.96E+10 | 4.96E+10 | 1.64E+09 | 1.64E+09 | NaN | NaN | 2.90E+11 | 2.90E+11 |
| 01/06/1950 | NaN | NaN | 4.95E+10 | NaN | 4.96E+10 | NaN | 1.64E+09 | NaN | NaN | NaN | 2.90E+11 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 01/03/2020 | 1.39E+13 | NaN | 3.67E+12 | NaN | 3.85E+12 | NaN | -5.26E+11 | NaN | 2.09E+13 | NaN | 2.15E+13 |
| 01/04/2020 | 1.20E+13 | NaN | 3.67E+12 | NaN | 3.85E+12 | NaN | -5.26E+11 | NaN | 1.90E+13 | NaN | 2.15E+13 |
| 01/05/2020 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 01/06/2020 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 01/07/2020 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
Tutorial Video Part 5 - The Holt Winters Model for Positive Values
Tutorial Video Part 6 - The Holt Winters Model for Negative Values
U.S.A.'s Investments' Estimates using the HW method
Investment forecasts:
2020-05-01 3.666572e+12
2020-06-01 3.664588e+12
2020-07-01 3.662814e+12
Freq: MS, dtype: float64
| Mean of Absolute Values | |
| Investment forecasts (monthly step data) | 3.66E+12 |
| Investment fitted values' real errors (monthly step data) | 7.88E+09 |
U.S.A.'s Government Investment using the HW method
Government Investment forecasts:
2020-05-01 3.866815e+12
2020-06-01 3.876213e+12
2020-07-01 3.885344e+12
Freq: MS, dtype: float64
U.S.A.'s Net Exports of Goods and Services using the HW method
df with Holt-Winters estimates
| Consumption (monthly data) | Investment (quarterly data) | Investment (monthly step data) | Government Investment (quarterly data) | Government Investment (monthly step data) | Net Exports (quarterly data) | Net Exports (monthly step data) | GDP Component Sum (quarterly data) | GDP Component Sum (monthly step data) | GDP (every quarter) | GDP (monthly step data) | Investment fitted values (monthly step data) | Investment forecasts (monthly step data) | Investment fitted values' real errors (monthly step data) | Government Investment fitted values (monthly step data) | Government Investment forecasts (monthly step data) | Government Investment fitted values' real errors (monthly step data) | Net Exports (monthly step data) positive | Net Exports fitted values (monthly step data) | Net Exports forecasts (monthly step data) | Net Exports fitted values' real errors (monthly step data) | |
| 01/02/1950 | NaN | 4.47E+10 | 4.47E+10 | 4.90E+10 | 4.90E+10 | 2.20E+09 | 2.20E+09 | NaN | NaN | 2.81E+11 | 2.81E+11 | 4.47E+10 | NaN | 1.53E-05 | 4.87E+10 | NaN | -2.13E+08 | 8.08E+11 | 2.20E+09 | NaN | 6.10E-04 |
| 01/03/1950 | NaN | NaN | 4.47E+10 | NaN | 4.90E+10 | NaN | 2.20E+09 | NaN | NaN | NaN | 2.81E+11 | 4.47E+10 | NaN | 1.53E-05 | 4.90E+10 | NaN | 7.02E+07 | 8.08E+11 | 2.20E+09 | NaN | 6.10E-04 |
| 01/04/1950 | NaN | NaN | 4.47E+10 | NaN | 4.90E+10 | NaN | 2.20E+09 | NaN | NaN | NaN | 2.81E+11 | 4.47E+10 | NaN | 1.53E-05 | 4.91E+10 | NaN | 1.92E+08 | 8.08E+11 | 2.20E+09 | NaN | 6.10E-04 |
| 01/05/1950 | NaN | 4.95E+10 | 4.95E+10 | 4.96E+10 | 4.96E+10 | 1.64E+09 | 1.64E+09 | NaN | NaN | 2.90E+11 | 2.90E+11 | 4.47E+10 | NaN | -4.73E+09 | 4.92E+10 | NaN | -4.68E+08 | 8.07E+11 | 2.20E+09 | NaN | 5.60E+08 |
| 01/06/1950 | NaN | NaN | 4.95E+10 | NaN | 4.96E+10 | NaN | 1.64E+09 | NaN | NaN | NaN | 2.90E+11 | 4.84E+10 | NaN | -1.10E+09 | 4.96E+10 | NaN | -3.65E+07 | 8.07E+11 | 1.68E+09 | NaN | 3.43E+07 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 01/03/2020 | 1.39E+13 | NaN | 3.67E+12 | NaN | 3.85E+12 | NaN | -5.26E+11 | NaN | 2.09E+13 | NaN | 2.15E+13 | 3.67E+12 | NaN | 3.05E+09 | 3.85E+12 | NaN | 2.84E+09 | 2.79E+11 | -5.25E+11 | NaN | 8.10E+08 |
| 01/04/2020 | 1.20E+13 | NaN | 3.67E+12 | NaN | 3.85E+12 | NaN | -5.26E+11 | NaN | 1.90E+13 | NaN | 2.15E+13 | 3.67E+12 | NaN | -1.43E+09 | 3.86E+12 | NaN | 1.34E+10 | 2.79E+11 | -5.18E+11 | NaN | 8.11E+09 |
| 01/05/2020 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 3.67E+12 | NaN | NaN | 3.87E+12 | NaN | NaN | NaN | -5.20E+11 | NaN |
| 01/06/2020 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 3.66E+12 | NaN | NaN | 3.88E+12 | NaN | NaN | NaN | -5.18E+11 | NaN |
| 01/07/2020 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 3.66E+12 | NaN | NaN | 3.89E+12 | NaN | NaN | NaN | -5.16E+11 | NaN |
Tutorial Video Part 7 - Backtesting our Method
The Setting for this video has changed, I do apologize for the lighting!
We will back-test our models from January 1990
Backtesting our Method with Investment data
In the graph above, we put ourselves in the shoes of an analyst who only has quarterly Investment data. She/He uses the latest quarterly releases of Investment data which spans from 1950 (in our example) to last quarter (last month at the earliest). She/He then uses the HW model to compute a forecast for the current period (month) - in yellow in the graph above.
Backtesting our Method with Government Investment data
Backtesting our Method with Net Exports data
G.D.P. Montly Estimates
Conclusion
It is possible to estimate monthly US GDP figures using the HW model to a good degree of accuracy. The final forecast even anticipated the fall in GDP caused by COVID-19 (in 2020) before official figures were released. Such estimates can not only be done via an Expenditure Approach but also an Income Approach; a mixture of the two would be an interesting study.
Note that it is possible to use this method to compute future monthly GDP forecasts.
References:
Mitchell, Smith, Weale, Wright, and Salazar (2005): James Mitchell, Richard J. Smith, Martin R. Weale, Stephen Wright, Eduardo L. Salazar, An Indicator of Monthly GDP and an Early Estimate of Quarterly GDP Growth, The Economic Journal, Volume 115, Issue 501, February 2005, Pages F108โF129, https://doi.org/10.1111/j.0013-0133.2005.00974.x