## Wednesday, September 27, 2023

### Principal Component Analysis for Nonstationary Series

Authors and guest post by Eren Ocakverdi

This blog piece intends to introduce a new add-in (i.e. HXPRINCOMP) that implements the procedure developed by Hamilton and Xi (2022).

### Introduction

In their paper, Hamilton and Xi (2022) propose a novel methodology when the goal is to extract the common factors behind the cyclical components of each of the series studied. They argue that focusing on the cyclical component of a time series offers a practical advantage; namely, it can be consistently estimated using an OLS regression while remaining agnostic about the stationarity of the underlying series.

### Principal components analysis on cyclical component

The procedure starts with estimating the following OLS regression for every variable: $$y_{it} = \alpha_{i0} + \alpha_{i1} \cdot y_{i,t-h} + \alpha_{i2} \cdot y_{i,t-h-1} + \cdots + \alpha_{ip} \cdot y_{i,t-h-p+1} + c_{it}$$ Here, $(h = 8)$ and $(p = 4)$ for quarterly data and $(h = 24)$ and $(p = 12)$ for monthly data. Authors postulate that true cyclical components, $( C_t = (c_{1t}, c_{2t}, \ldots, c_{Nt})^top )$, are characterized by a factor structure $( r \ll N )$ of the form: $$\underbrace{\mathbf{C}_t}_{(N \times 1)} = \underbrace{\Lambda}_{(N \times r)} \cdot \underbrace{\mathbf{F}_t}_{(r \times 1)} + \underbrace{\mathbf{e}_t}_{(N \times 1)}$$ Authors also show that even if the cyclical components are not observed and are therefore estimated $( \hat{c}_{it} = c_{it} + \upsilon_{it} )$, true factors can still be consistently estimated under certain conditions.

### Application to U.S. Treasury Yields

As a first example, authors apply their method to treasury yields with different maturities (see Figure 1). Figure 1: Yields on different maturities.

The downward trend in raw yields data is obvious, but authors prefer not to apply any transformation to make the series stationary. To run the procedure on yields data, we can use the add-in (see Figure 2). Figure 2: GUI of the add-in for yields example

Input parameters are set to match that of original study. Four principal components are extracted. However, loading factors are of main interest for this particular exercise as they are the key parameters that summarize the dynamics of yield curve (see Figure 3). Figure 3. Factor loadings for the cyclical data of yields

The coefficient relating yields to the first factor is called the level factor and is more-or-less the same for all maturities. Loading on the second factor is called slope and is positive for long rates, but negative for short rates. The third factor is called curvature and has a negative weight for bonds with very short or very long maturity.

### Application to large macroeconomic data sets

When using principal components analysis on large macroeconomic data sets, one may need to transform each of the variables to ensure stationarity. Since it is done individually, it could be a tedious task. Extracting the cyclical component of series solves this problem by design.

As a second example, authors apply their methodology to a large macroeconomic data set (2022-4 vintage of FRED-MD database), which covers 127 variables. To run the procedure on macroeconomic data, once again we can use the add-in (see Figure 4). Figure 4. GUI of the add-in for FRED example

In order to deal with missing values in the data set a balanced sample is used. Eight principal components are extracted and the first two are depicted in Figure 5 below. Figure 5. First and second PC of cyclical components of FRED-MD variables.

Authors argue that their series correctly summarizes cyclical movements not only in early periods, but especially during 2020. They find that while the first factor captures the real economic conditions, the second factor is mainly related to nominal prices and interest rates. Please note that the procedure does not require any stationarity corrections for the series or special treatment for outliers!

### References

1. Hamilton, J. D., and Xi, J. (2022), Principal Component Analysis for Nonstationary Series, Working Paper, UC San Diego.

#### 1 comment:

1. Excellent work!