State of the Business Cycle — Part II

Learn how to identify the length and magnitude of the U.S. Business Cycle using regression-based approaches in Julia.

Jens Herold
5 min readNov 1, 2020
Office Life — Photo taken by the author, Wiesbaden — Germany (2019).

In the first part of this series, we used Julia and the Fred API® to download a long-run time-series of U.S. real GDP. We observed that U.S. real GDP has been growing extensively over the last 75 years. However, in some years, like 2020, real GDP growth declined dramatically.

In this part, we will learn to apply several statistical detrending techniques that separate the GDP time series from its trend and obtain a cyclical component.

What is the economic intuition behind this?

We can think of the unobservable long-run trend component as GDP at its full potential or the steady-state value of GDP. Potential GDP is a theoretical concept in which all factors of production (e.g. capital and labor) are used in an efficient and sustainable, which means a non-exhaustive, manner. Factors such as population growth and migration, technological advances, or the quality of (government) institutions usually have a strong impact on potential GDP.

Hence, actual GDP (the one observed in the data) can be either above or below its potential level. These swings — or the gap between observed and potential output — are temporary as e.g. employees tend to work overtime in a boom, or reduce hours in a recession.

We will start with a simple, regression-based approach to estimating U.S. real potential GDP and the U.S. output gap. It is based on de-trending using linear, quadratic, and cubic time trends. Later we will compare our estimates of the U.S. potential GDP with figures provided by the Congressional Budget Office (CBO).

How can we remove the trend and isolate the cycle?

Let’s think of real GDP as a time series Y, that is the product of several unobservable components:

A long-run trend T, fluctuations at typical business cycle frequency C (usually between 6 and 40 quarters), seasonal fluctuations S (on much higher frequencies), and noise U. More formally we can put it like this:

To make our lives easier, we use seasonally-adjusted data, which means all fluctuations due to seasonal events, like the holiday season, summer vacations or weather variation throughout the year, are constant. Moreover, we assume that unobserved noise has no systematic and permanent impact on the data.

This leaves us with the trend and cyclical component.

We take logs of the series to facilitate the subsequent analysis and make use of the following property for any variable X:

A simple log-approximation using a 1st-order Taylor series expansion.

That is, the percentage change (over time) of any variable X is approximately equal to its first-order log-difference. Thus, applying this to our GDP series, we can express the cyclical component C or Output Gapwhich by definition is the percentage deviation of GDP Y from its long-run trend T — as follows:

The cycle is the percentage deviation of GDP from its long-run trend.

As a consequence: It remains to estimate the (log)-trend or potential GDP and subtract it from the (log-) data to find the cycle. Pretty simple, right?

Time trends in Ordinary Least Squares (OLS) regressions

Let us begin with an Ordinary Least Squares (OLS) regression. We fit a constant c and a trend T (linear, quadratic, or cubic) to the (log-) data and such that:

OLS-Regression with a linear time-trend.

is the regression equation. We generate the trend variable by assuming that log(T) increases by one unit every period. In case we want to fit a quadratic or cubic variant to the data we add the second or third moment of T to the regressor matrix, respectively. In case of a quadratic trend, the OLS-model fits

OLS-Regression with a quadratic time-trend.

to the data. The estimated cyclical component — or the residual — follows directly from the fit of the regression:

The cyclical component: The regression residual.

Let us compare the respective outcomes for estimates of the cyclical com-ponent (depending on the underlying trend assumption) with the U.S. Output Gap provided by the CBO.

Comparing the cyclical components of U.S. GDP with the official U.S. Output Gap (CBO).

The plot reveals several striking features:

First, there is a massive variation between the different trend-adjusted series and the CBO output gap (calculated from the CBO’s estimate of U.S. potential real GDP).

Second, assuming that U.S. potential GDP follows a simple linear trend leads to huge errors in estimating the output gap compared to the one obtained from CBO estimates. Allowing for a higher degree of curvature (quadratic and cubic detrending) fits the data much better.

This eye-balling evidence can be supported by looking at the correlation between the CBO Output gap and our calculations. The linear de-trended output gap is only weakly correlated with the CBO Output gap (ρ = 0.26). On the contrary, the quadratic and the cubic de-trended output gaps exhibit a high correlation instead (ρ = 0.71; ρ = 0.75).

That means, they work great in determining whether the economy in an expansion or a contraction phase.

Third, all three approaches have difficulties getting close to the level of the CBO output gap. This becomes visible when you look at the first observation in each subplot of the graph. Depending on the underlying method, the estimated output gaps are between -15 and 0 %. On average, absolute deviations still range between 1.7 and 6 percentage points.

If you are disappointed that the discussed method fails to come close to the CBO data in some aspects — do not despair. Bear in mind that CBO’s potential output is an estimated figure as well. It is the respective methodology economists employ, which leaves plenty of room for debate.

The article finishes with the code used to reproduces the figures and calculations discussed above. It is written in Julia and uses the Fred API® to download a long-run time-series of U.S. real GDP and estimate the regression equations. If you like to learn how to combine the Fred API® in Julia, check out this previous article of mine.

Thanks for bearing with me. I hope you enjoyed this article.

--

--

Jens Herold

German economist who is mainly interested in fiscal and monatary economics, inequality and economic modelling. https://www.linkedin.com/in/heroldjens/