Only quarterly USA GDP data is published; this article describes a method of estimating monthly such figures using monthly Total Compensation figures.
Introduction
Gross Domestic Product (GDP) is often thought of and calculated with an Expenditure Approach such that GDP=C+I+G+(X−M) where C = Consumption, I = Investment, G = Government Spending, & (X–M) = Net Exports, but it is also possible to calculate it via a per worker Income Approach. With this approach, we may estimate GDP Per Worker (GDPPW) with Total Compensation Per Worker (TCPW) figures such that (as per Appendix 1):
where
We can then attempt to interpolate GDPPW values at higher frequencies than they are officially released with higher wage/income figure releases (exempli gratia (e.g.): to compute monthly GDP figures when only quarterly ones are released using monthly published Total Compensation data).
We have to be careful of a few difficulties outlined by Feldstein (2008) (MF hereon): "The relation between productivity [ id est (i.e.): GDP] and wages has been a source of substantial controversy, not only because of its inherent importance but also because of the conceptual measurement issues that arise in making the comparison." (Feldstein (2008)). MF outlines several key factors (KF hereon) to consider when studying the question:
- "[An undeserved] focus on wages rather than total compensation. Because of the rise in fringe benefits and other noncash payments, wages have not risen as rapidly as total compensation. It is important therefore to compare the productivity rise with the increase of total compensation rather than with the increase of the narrower measure of just wages and salaries.” This is why this article will first focus on using Total Compensation (TC).
- “[… The] nominal compensation deflated by the CPI is not appropriate for evaluating the relation between productivity and compensation […] this implies that the real marginal product of labor should be compared to the wage deflated by the product price and not by some consumer price index. [...] The CPI differs from the nonfarm product price in several ways. The inclusion in the CPI, but not in the nonfarm output price index, of the prices of imports and of the services provided by owner occupied homes is particularly important." This is why this article will first focus on using Nominal T.C. deflated (made 'real') with the Nonfarm Business Sector Output Price Index Deflator (NBSOPID).
Keeping these points in mind, we will attempt to investigate the relationship between the United States of America( U.S.A.)'s Real GDP (RGDP) and U.S.A.'s Real National Total Compensation (RNTC) in order to construct a framework allowing us to estimate monthly RGDP data when only quarterly data is published.
Numerical Approximation
Background
As per Appendix 1:
It may seem needlessly convoluted to insert 𝑟𝑡 the way it was done above, but it was necessary due to the fact that we have 𝑟𝑡rt estimates (𝑟𝑡ˆ) - we thus build our framework around it: since Total Compensation figures are released on a monthly basis, if we can construct an estimate for the linearly-time-variant 𝑟𝑡rt, we can then construct monthly GDP figures (even though only quarterly ones are published).
This article will study the efficiency of the USA Real GDP Per Worker To National Real Total Compensation Per Worker Ratio (RGDPPWTNRTCPWR) as the ratio '𝑟𝑡'.
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 statistics, datetime and dateutil are also required.
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 installpip 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
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.
USA Working Population Growth
We will use Yearly Geometric Growth rate when looking at geometric growth rates throughout this article, as outlined in Appendix 2.
We proportion of population which works. This includes only employed adults, excluding children (~ 20% of USAP) and the elderly (~ 14% of USAP). The cell below adds the United States of America's Working Population (USAWP) values to the data-frame 'df' and plots our population data this far:
Next we take the USA Working Population's first Difference, i.e.: 𝑈𝑆𝐴𝑊𝑃𝐷𝑡=𝑈𝑆𝐴𝑊𝑃𝑡−𝑈𝑆𝐴𝑊𝑃𝑡−1
USA's Working Population's single period (in this case: monthly) Geometric Growth is then defined as USAWPG as per Appendix 2:
Our U.S.A.'s Working Population' Yearly Geometric Growth is 0.012018187303719507, i.e.: 1.2018187303719507%
Total Compensation
As per MF's first KF, we use USA Nominal National Total Compensation (NNTC) - the nominal value of which is derived from National Nominal Personal Income Accounts. Note that this dataset is the inflows into accounts; this means that we do not need to include incomes from assets. Note also that deflators used to compute 'real' figures form 'nominal' are defined in Appendix 3.
National Nominal Total Compensation
We can now add out National Nominal Total Compensation (NNTC) data in our data-frame and plot if for good measure.
As per MF, Nonfarm Business Sector Output Price Index Deflator (NBSOPID) is used to calculate USA's Real Total Compensation figures.
Since the incoming data is indexed on 2012 such that the 'RAW' and unaltered value from DataStream is 𝑅𝐴𝑊𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑡(2012−01−01) = 100 where 𝑡(2012−01−01) is the time subscript value for 01 January 2012, we define 1 / 𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑡 as 𝑅𝐴𝑊𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑡 / 𝑅𝐴𝑊𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑇. Note that the inversion of 𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑡 was only necessary as the raw values were inverted (such that 𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑡 = 𝑅𝐴𝑊𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑇 / 𝑅𝐴𝑊𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑡)(such that NBSOPIDt = RAWNBSOPIDT / RAWNBSOPIDt). NBSOPID figures are released every quarter - that's fine since we don't expect inflation to change too much from one month to the other, so quarterly data is sufficient.
USA National Real Total Compensation is defined as 𝑁𝑅𝑇𝐶𝑡 = 𝑁𝐵𝑆𝑂𝑃𝐼𝐷𝑡 ∗ 𝑁𝑁𝑇𝐶𝑡
USA National Real Total Compensation Per Worker is defined as 𝑁𝑅𝑇𝐶𝑃𝑊𝑡 = 𝑁𝑅𝑇𝐶𝑡 / 𝑈𝑆𝐴𝑊𝑃𝑡
How does Total Compensation compare to GDP through time?
The cell below adds USA Real GDP's quarterly data (both every quarter and every month) in net and in Trillions to the Pandas data-frame 'df':
The cell below adds USA Real GDP per Capita (𝑅𝐺𝐷𝑃𝑃𝐶) and Per Worker (𝑅𝐺𝐷𝑃𝑃𝑊) to our Pandas data-frame (df) and plots our data concisely:
The cell below adds U.S.A. Real G.D.P. Per Worker To National Real Total Compensation Per Worker Ratio (𝑅𝐺𝐷𝑃𝑃𝑊𝑇𝑁𝑅𝑇𝐶𝑃𝑊𝑅) to our Pandas data-frame (df) and plots it:
The graph above displays GDP and Total Compensation per worker figures as well as the ratio between the two (the latter is shown in green). It is this ratio that we use as our 𝑟r in the estimation model:
Since (as per Appendix 1) we deffined 𝑟𝑡 = 𝑅𝐺𝐷𝑃𝑃𝑊𝑡 / 𝑅𝑁𝑇𝐶𝑃𝑊𝑡, 𝑟𝑡−1 values do not need to be forecasted or modeled - we have the data needed to compute 𝑟𝑡−1 = 𝑅𝐺𝐷𝑃𝑃𝑊𝑡 − 1 / 𝑅𝑁𝑇𝐶𝑃𝑊𝑡−1.
𝑟𝑡 values - however - require values of 𝑅𝐺𝐷𝑃𝑃𝑊𝑡 for month 𝑡t, which are not published: this is where an estimate of ˆrt comes in useful.
How may we model our estimate of 𝑟𝑡? The first models that come to mind are linear regression models; the below investigates the regression of USA Real GDP Per Worker To National Real Total Compensation Ratio (RGDPPWTNRTCPWR) against time (i.e.: months).
Regression of USA Real GDP Per Worker To National Real Total Compensation Per Worker Ratio against time
Here we use RGDPPWTNRTCPWR as 𝑟r such that 𝑦𝑡ˆ = 𝑐 + 𝛽𝑥𝑡 where 𝑦𝑡ˆ = 𝑅𝐺𝐷𝑃𝑃𝑊𝑇𝑁𝑅𝑇𝐶𝑃𝑊𝑅𝑡ˆ = 𝑟𝑡ˆ , 𝑥𝑡 is time in months, and 𝑐 & 𝛽 are computed to reduce the error of this model (i.e.: to reduce the 'error' term - ϵ - in 𝑦𝑡 = 𝑐 + 𝛽𝑥𝑡 + 𝜖𝑡 where 𝑦𝑡 = 𝑅𝐺𝐷𝑃𝑃𝑊𝑇𝑁𝑅𝑇𝐶𝑃𝑊𝑅𝑡 = 𝑟𝑡) via Ordinary Least Square estimation:
| Mean of Absolute Values | |
| RGDPPWTNRTCPWR (monthly data) | 0.907876 |
| RGDPPWTNRTCPWR regressed on months | 0.907876 |
| RGDPPWTNRTCPWR regressed on months' errors | 0.0241528 |
The statistics table shows a healthily low absolute (as in: ignoring the sign) error mean value for RGDPPWTNRTCPWR's regression model of 0.0242910.024291.
We seem to have gathered evidence that a time-linear model may be a good way to estimate 𝑟r and then monthly GDP. Remember that we will measure the effectiveness of our models by how they estimate GDP values at lower frequencies than they are published by official bodies (here: monthly, using monthly released Total Compensation data); an accurate estimation of our ratio is therefore paramount. One may thus attempt to look at estimates produced by methods other than straight forward linear regressions, e.g.: the Holt-Winters method. Let's investigate that method too:
Holt-Winters method
All estimation methods are to be used recursively. The Holt-Winters method makes sure that forecasts are heavily influenced by latest values by design. It offers better (i.e.: lower) model error (see model fit graph below) than our linear regressions too.
Nota Bene (N.B.): A non multiplicative Holt-Winters method is used here as computational limits mean that multiplicative Holt-Winters methods result in very many 'NaN' estimates that are unusable.
The cell below creates recursive RGDPPWTNRTCPWR Holt-Winters exponential smoothing estimates (RGDPPWTNRTCPWRHW); this means that we are using 𝑅𝐺𝐷𝑃𝑃𝑊𝑇𝑁𝑅𝑇𝐶𝑃𝑊𝑅𝑡−1 as 𝑟𝑡−1 and 𝑅𝐺𝐷𝑃𝑃𝑊𝑇𝑁𝑅𝑇𝐶𝑃𝑊𝑅𝐻𝑊𝑡 as 𝑟𝑡ˆ :
| 01/04/2020 | 1.143114 |
| 01/05/2020 | 1.143141 |
| 01/06/2020 | 1.143158 |
| 01/07/2020 | 1.143169 |
| 01/08/2020 | 1.143176 |
| 01/09/2020 | 1.14318 |
| 01/10/2020 | 1.143183 |
| 01/11/2020 | 1.143185 |
| 01/12/2020 | 1.143186 |
| 01/01/2021 | 1.143186 |
| 01/02/2021 | 1.143187 |
| 01/03/2021 | 1.143187 |
Freq: MS, dtype: float64
| Mean of Absolute Values | |
| RGDPPWTNRTCPWR regressed on months' errors | 0.0241528 |
| RGDPPWTNRTCPWRHW fitted values' real errors (monthly data) | 0.00773767 |
The Holt-Winters model's estimates - 𝑟ˆr^ - (in yellow) closely follow the realised RGDPPWTNRTCPWR values. This only holds untrue at the start (approximately for the first 2 years) when the model needs training. The (short) green line shows monthly forecasts for the next 4 years computed with this Holt-Winters model.
The statistics table clearly hows that the Holt -Winters model performs much better than the time-linear regression model: its errors are - on average - a lot lower (i.e: 0.0077352<0.024291).
Backtesting our Method
The Python function defined in the cell below returns the In-Sample Recursive Prediction values of ' data ' using the Holt-Winters exponential smoother Plus it then provides forecasts for One Out-Of-Sample period (thus the acronym 'ISRPHWPOOOF'):
We will back-test our models from January 1990
Remember that the ratio 𝑟𝑡rt is𝑅𝐺𝐷𝑃𝑃𝑊𝑡 / 𝑅𝑁𝑇𝐶𝑃𝑊𝑡RGDPPWtRNTCPWt, but 'today' (i.e.: at time 𝑡t), there is no 𝑅𝐺𝐷𝑃𝑃𝑊𝑡 value we can use (since only quarterly figures are published), this is why we made a forecast. As a result, we will differentiate between 𝑟𝑡ˆ as including the forecast (actually used as an estimate) at time 𝑡t as ' r_f ' ('f' for forecasted) and 𝑟𝑡−1 as ' r ' which does not use forecasts:
Modeled estimates (r_f) follow the realised 𝑟r values (r) so closely that it is difficult to differentiate them.
Remember also that 𝑅𝐺𝐷𝑃𝑃𝑊𝑡 = ( 𝑟𝑡 / 𝑟𝑡−1 )∗ ( 𝑅𝑁𝑇𝐶𝑃𝑊𝑡 / 𝑅𝑁𝑇𝐶𝑃𝑊𝑡−1 ) ∗ 𝑅𝐺𝐷𝑃𝑃𝑊𝑡−1, thus: RGDPPW estimate = 𝑅𝐺𝐷𝑃𝑃𝑊𝑡ˆ = (𝑟𝑡ˆ / 𝑟𝑡ˆ−1 ) ∗ ( 𝑅𝑁𝑇𝐶𝑃𝑊𝑡 / 𝑅𝑁𝑇𝐶𝑃𝑊𝑡−1 ) ∗ 𝑅𝐺𝐷𝑃𝑃𝑊𝑡−1
Yet again, looking at the realiations and model outputs on the same graph(s), it is difficult to see the model outputs because they follow realisations so well; the errors' graph and table shines a light on how small the error is:
The difference between the lowest and 2nd lowest (as well as the highest and 2nd highest) troughs (and peaks) is less significant in the Proportional Error graph than in the straight forward Error graph.
Since RGDP figures are only released quarterly, it is best to investigate errors at each quarter
| Mean of Absolute Values | |
| RGDPPW estimates' errors | 592.39 |
| RGDPPW estimates' proportional errors | 0.00666185 |
then:
| RGDP (monthly data) | RGDP estimates | |
| 01/02/1990 | 5.87E+12 | 5.81E+12 |
| 01/03/1990 | 5.87E+12 | 5.86E+12 |
| 01/04/1990 | 5.87E+12 | 5.91E+12 |
| 01/05/1990 | 5.96E+12 | 5.85E+12 |
| 01/06/1990 | 5.96E+12 | 5.93E+12 |
| ... | ... | ... |
| 01/11/2019 | 2.17E+13 | 2.17E+13 |
| 01/12/2019 | 2.17E+13 | 2.17E+13 |
| 01/01/2020 | 2.17E+13 | 2.19E+13 |
| 01/02/2020 | 2.15E+13 | 2.19E+13 |
| 01/03/2020 | 2.15E+13 | 2.13E+13 |
It would be redundant testing the validity of these figures since we already did so when investigating Real GDP Per Worker estimates above.
Note also that for values today - at time 𝑇 - and/or close to today (e.g.: next month), 𝑅𝐺𝐷𝑃≈𝐺𝐷𝑃, and population growth is negligable, such that 𝑈𝑆𝐴𝑊𝑃𝑇 ≈ 𝑈𝑆𝐴𝑊𝑃𝑇+1, then:
It is therefore possible to use our method to predict future GDP values on a monthly basis.
References
You can find more detail regarding the DSWS API and related technologies for this article from the following resources:
- DSWS page on the Refinitiv Developer Community web site.
- DSWS API Quick Start Guide page.
- DSWS Tutorial page.
- DSWS API Python Reference Guide.
For any question related to this example or Eikon Data API, please use the Developers Community Q&A Forum.
Literature:
DOWNLOADS
Article.DataStream.Python.EstimatingMonthlyGDPFiguresViaAnIncomeApproachGitHub