EconBase
← Back to paper

Machine Learning and the Yield Curve: Tree-Based Macroeconomic Regime Switching

Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.

86,285 characters · 16 sections · 39 citation commands

Rendered from LaTeX for readability, not typeset faithfully. Citation keys are highlighted; maths is left as source; figures, tables and equation environments are summarised rather than reproduced; unrecognised commands are greyed out so nothing is silently dropped. Email addresses are removed.

Machine Learning and the Yield Curve: Tree-Based Macroeconomic Regime Switching

spacing{1} Abstract: We explore tree-based macroeconomic regime-switching in the context of the dynamic Nelson-Siegel (DNS) yield-curve model. In particular, we customize the tree-growing algorithm to partition macroeconomic variables based on the DNS model's marginal likelihood, thereby identifying regime-shifting patterns in the yield curve. Compared to traditional Markov-switching models, our model offers clear economic interpretation via macroeconomic linkages and ensures computational simplicity. In an empirical application to U.S. Treasury yields, we find (1) important yield-curve regime switching, and (2) evidence that macroeconomic variables have predictive power for the yield curve when the federal funds rate is high, but not in other regimes, thereby refining the notion of yield-curve “macro-spanning". { Acknowledgments: We gratefully acknowledge helpful input from Yacine Ait-Sahalia, Michael Bauer, Sid Chib, Nour Meddahi and Mike West, as well as participants at the Stevanovich Center Conference on Big Data and Artificial Intelligence in Econometrics, Finance, and Statistics (University of Chicago), 2025 NSF/CEME Conference in Bayesian Inference in Econometrics and Statistics, and the FinEML Conference (USI Lugano). We thank Jacob Broussard for research assistance. All remaining errors are ours alone.} Keywords: Decision Tree; Macro-Finance; Term Structure; Regime Switching; Dynamic Nelson-Siegel Model; Bayesian Estimation JEL Classification: C11, E43, G12 Contact Information: [email removed] (Bie); [email removed] (Diebold); \\ [email removed] (He); li\[email removed] (Li)

\thispagestyle{empty}

\setcounter{page}{1}

\thispagestyle{empty}

Introduction

Yield-curve modeling plays a crucial role in asset pricing, risk management, and monetary policy. The Nelson-Siegel yield-curve model nelson1987parsimonious has long been popular among both researchers and practitioners due to its simultaneous accuracy and parsimony. diebold2006forecasting introduce a dynamic Nelson-Siegel (DNS) model, allowing for three unobserved pricing factors (level, slope, and curvature) that evolve smoothly over time.\footnote{See diebold2013yield for a full exposition with variations and extensions.} However, in practice, the yield curve does not always evolve smoothly. Its underlying factors can experience abrupt shifts, particularly in response to the macroeconomy. This highlights the importance of possible yield-curve regime switching, and the importance of understanding how yield-curve regimes relate to macroeconomic conditions.

Economists have studied yield-curve regime switching Dai2007, hevia2015estimating, typically invoking Markov-switching behavior \`a la hamilton1989new and kim1994dynamic.\footnote{See also gray1996, ang2002regime, bansal2002term, and xiang2013regime.} However, the latent nature of the “hidden Markov" regimes makes it challenging to understand what the regimes actually represent, resulting in a lack of clear economic interpretation. Although several studies attempt to interpret regimes in terms of macroeconomic conditions such as real activity or asset market volatility hamilton1989new, bansal2002term, those interpretations often have the feel of ex post rationalization. In addition, chib2009analysis propose a Bayesian affine yield curve model and chib2013change study the change points of it. Much remains to be done in terms of developing an economically interpretable methodology for detecting macroeconomics regime changes and relating them to the yield curve.

In this paper we fill the void by developing a novel DNS extension that incorporates regime switching, which we call macro-instrumented DNS regimes. We make two related contributions. First, we allow the DNS yield factors to switch dynamics across macroeconomic regimes, which we detect using a customized tree structure based on the values of an observable set of macroeconomic variables. Using Bayesian methods, we choose optimal split candidates based on the marginal DNS likelihood, which enhances regime interpretability and provides a macroeconomically meaningful understanding of yield-curve dynamics.\footnote{We therefore make contact with two important recent literatures -- one that uses goal-orientated tree-based clustering with economic targets cong2025growing, feng2024currency, cong2023sparse, patton2023generalized, and one that implements Bayesian analysis of regression tree models chipman2010bart, he2019xbart, he2023stochastic, krantsevich2023stochastic.}

Second, we contribute to the long-standing debate on whether the yield curve spans the macroeconomy (“macro-spanning"), meaning that all current and past macroeconomic information of relevance for bond pricing is contained in the current yield curve. Such macro-spanning implies, among other things, that macroeconomic variables have no predictive content for the yield curve. The validity of macro-spanning, however, is far from uncontentious. On the one hand, macro-spanning is a key implication of the popular class of affine yield-curve models, as reviewed for example in bauer2017resolving. In those models,

spacing{1} \begin{quote} ... the short-term interest rate is represented as an affine function of risk factors ... that include macroeconomic variables. Accordingly, the assumption of the absence of arbitrage and the usual form of the stochastic discount factor imply that model-implied yields are also affine in these risk factors. This linear mapping from macro factors to yields can ... be inverted to express the macro factors as a linear combination of yields. Hence, these models imply ... “spanning”..., \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad\quad bauer2017resolving \end{quote}

and it has found some empirical support, as in bauer2017resolving. On the other hand, macro-spanning is rejected by several other studies, ranging from the early work of ang2003no through more recent work like joslin2014risk and bekaert2021macro.\footnote{See also dewachter2006macro, diebold2006macroeconomy, ludvigson2009macro, duffee2011, chernov2012term, and coroneo2016unspanned.} Those studies, however, are based on linear models, whereas we investigate macro-spanning through the more nuanced nonlinear lens of macro-instrumented regime switching, which allows for the possibility that macro-spanning might hold in some macroeconomic regimes but not in others.

We proceed as follows. In section (ref) we review the DNS model and introduce our tree-based macro-instrumented regime-detection framework. In section (ref) we present empirical results for U.S. treasury yields, and we conclude in section (ref).

Dynamic Nelson-Siegel with Macro-Instrumented Regime Switching

In this section we introduce our modeling framework and estimation strategy, and we examine its performance in a small simulation.

The State-Space Model

We first introduce the “yields-only" dynamic Nelson-Siegel model \citep*{diebold2006forecasting} and its extension to the “yields-macro" yield-curve model \citep*{diebold2006macroeconomy} on which we will focus.

Yields-Only

DNS extends the original static Nelson-Siegel model nelson1987parsimonious by writing the time-$t$ maturity-$\tau$ yield $y_t(\tau)$ as:

equation[equation omitted — 237 chars of source]

$t=1, ..., T$, where the three parameters $L_t$, $S_t$, $C_t$ are allowed to vary over time and are interpreted as level, slope, and curvature factors, respectively; $\varepsilon_t(\tau)$ is a stochastic shock capturing pricing error; and $\lambda$ is a parameter. The measurement equation relating the $N$ observed yields to the three latent factors is then $$

pmatrix[pmatrix omitted — 80 chars of source]

=

pmatrix[pmatrix omitted — 512 chars of source]
pmatrix[pmatrix omitted — 35 chars of source]

+

pmatrix[pmatrix omitted — 119 chars of source]

. $$ Finally, the DNS model assumes VAR(1) transition dynamics for the state vector $(L_t, S_t, C_t)'$, thus forming a well-defined state-space system.

We now allow for regime switching in the latent factors. Specifically, assume there are $G$ regimes in total, and let $z_{t} \in \{ 1, 2, \cdots, G \}$ indicate the time-$t$ regime. Conditional on regime, we write the model as

equation[equation omitted — 285 chars of source]

where $\mathbf{f}_t = (L_t, S_t, C_t)^T$ are the factors, $\mathbf{F}_t = \mathbf{f}_t - \boldsymbol{\mu}_{z_t}$ are the demeaned factors, and $\mathbf{y}_t = (y_t(\tau_1), \cdots, y_t(\tau_N))^T$ are the $N$ yields at the $t$-th period. In particular, we assume the transition equation may be affected by regime changes such that the mean of the factors, $\boldsymbol{\mu}_{z_{t-1}}$, and the VAR evolution matrix, $\mathbf{A}_{z_{t-1}}$, depend on last period's regime, $z_{t-1}$, which is determined conditional on the information set through period $t-1$. Furthermore, we make the standard assumption that the measurement and transition disturbances are independent and jointly normal,

equation[equation omitted — 261 chars of source]

We allow the dense covariance matrix of the factor innovations, $\mathbf{H}_{z_t}$, to vary contemporaneously with $z_t$. In contrast, we assume sparse (diagonal) measurement-error covariance matrix, $\mathbf{Q}=\text{diag}(\sigma^2_1, \cdots, \sigma^2_N)$, so that the residuals of the yields at different maturities are uncorrelated.

Yields-Macro

The above yields-only model can be extended to a yields-macro version that allows exploration of the relationship between the yield factors and macroeconomic variables. Following diebold2006macroeconomy, we examine three major macroeconomic variables: capacity utilization $\mathop{\mathit{CU}}\nolimits_t$ as an indicator of real economic activity (“quantities"), the federal funds rate $\mathop{\mathit{FFR}}\nolimits_t$ as an indicator of the central bank stance (“policy"), and inflation $\mathop{\mathit{INFL}}\nolimits_t$ as an indicator of nominal activity (“prices"). We set $\mathbf{m}_t = (\mathop{\mathit{CU}}\nolimits_t, \mathop{\mathit{FFR}}\nolimits_t, \mathop{\mathit{INFL}}\nolimits_t)^T$, and we use it to augment the 3-dimensional “yields-only" model in Equation ((ref)), producing a six-dimensional “yields-macro" model state space model.

Let $\mathbf{M}_t = \mathbf{m}_t-\boldsymbol{\mu}_{z_t}^m$ be the demeaned macroeconomic factors, let $\mathbf{FF}_t = (\mathbf{F}_t, \mathbf{M}_t)^T$, and assume that the yield and macroeconomic factors in $\mathbf{FF}_t$ follow undelated VAR(1) processes. Then the yields-macro augmented state-space model is

equation[equation omitted — 662 chars of source]

where $\mathbf{A}_{z_{t-1}} =

pmatrix[pmatrix omitted — 123 chars of source]

$, $\boldsymbol{\mu}_{z_t} = (\boldsymbol{\mu}_{z_t}^F, \boldsymbol{\mu}_{z_t}^m)^T$, $\boldsymbol{\varepsilon}_t = (\boldsymbol{\varepsilon}_{t}^y, \boldsymbol{\varepsilon}_{t}^m)^T$, $\boldsymbol{\eta}_t = (\boldsymbol{\eta}_t^y, \boldsymbol{\eta}_t^m)^T$, and the measurement and transition shocks are assumed to have the same stochastic structure as in Equation ((ref)).

In closing this section, we emphasize that we use “yields-only", or “yields-only DNS", or (e.g., if $G=3$) “3-regime yields-only DNS" to refer to model ((ref)), and we similarly use “yields-macro", or “yields-macro DNS", or “3-regime yields-macro DNS" to refer to model ((ref)). In what follows we will focus almost exclusively on the yields-macro model ((ref)), which includes the yields-only model ((ref)) as a special case and permits not only the incorporation of regime switching, but also exploration of interactions between yield and macro variables in various regimes.

Bayesian Estimation

We proceed in two steps. First we treat estimation assuming exogenously-known regimes, and then we incorporate endogenous regime determination (learning).

Regimes Known

We take a full Bayesian approach, estimating all model parameters using the Kalman filter/smoother in conjunction with Markov chain Monte Carlo (MCMC).

\paragraph{Priors.} We use standard conjugate priors for all parameters.

For the diagonal elements of $\mathbf{A}_g$, which drive the factor autocorrelations, we use normal priors. For the off-diagonal elements in $\mathbf{A}_g$ we use spike-and-slab priors george1993variable, which shrink weak signals toward zero while maintaining strong signals at values close to OLS estimates, thereby helping with sparse matrix estimation. The spike-and-slab prior for $a_{j,k}^g$ (the $(j,k)$-th element of $\mathbf{A}_g$) is

equation*[equation* omitted — 370 chars of source]

We set the hyperparameter $\omega$ to 0.5, corresponding to agnostic beliefs regarding the off-diagonal elements in $\mathbf{A}_g$.

For the covariance matrices $\mathbf{Q}$ and $\mathbf{H}_g$, we use inverse Wishart priors. Because $\mathbf{Q}$ is diagonal, the inverse Wishart prior degenerates to the inverse Gamma prior for each diagonal element $\sigma^2_i$. For the factor mean $\mu_g$ we use a normal prior, and for the decay parameter $\lambda$ we use a uniform prior. Thus we write

equation*[equation* omitted — 268 chars of source]

Note that, departing from diebold2006forecasting where $\lambda$ is calibrated at a fixed constant (0.0609), we allow $\lambda$ to be learned from the data and updated by a random-walk Metropolis-Hastings step. See Appendix (ref) for details of all prior specifications and the Gibbs sampler for posterior inference.

\paragraph{Marginal Likelihood.} We now discuss the marginal likelihood of the yields-macro model.\footnote{The marginal likelihood of the yields-only model ((ref)) is similar and is of course subsumed by the yields-macro model.} The marginal likelihood is central to Bayesian model comparison and selection, because unknown model parameters are “integrated out", thereby accounting for parameter estimation uncertainty and making it solely a function of the data. Most importantly for our purposes, it will play a crucial role in facilitating endogenous regime determination, to which we will soon move in section (ref).

Let $\boldsymbol{\Theta} = \left(\boldsymbol{\Lambda}, \mathbf{F}_t, \{\mathbf{A}_g\}_{g=1}^G, \{\boldsymbol{\mu}_g\}_{g=1}^G, \{\mathbf{H}_{g}\}_{g=1}^G, \mathbf{Q}\right)$ denote all parameters and latent factors in the yields-macro model (ref), and let $L(\mathbf{y}_t, \mathbf{m}_t, \mathbf{z}_t \mid \boldsymbol{\Theta})$ be the corresponding likelihood function. The latent factors $\mathbf{F}_t$ are unknown parameters requiring estimation, and there can be as many as 1,800 for a sample size of 600 months with three latent factors. It is therefore helpful to first integrate out the latent factors $\mathbf{F}_t$, producing a partial marginal likelihood, which for one time period is

equation*[equation* omitted — 579 chars of source]

a normal density whose mean and covariance matrix we present in Appendix (ref). The full partial marginal likelihood for all periods is then

equation[equation omitted — 412 chars of source]

where $\mathbf{Y} = \{\mathbf{y}_t\}_{t=1}^T$, $\mathbf{M} = \{\mathbf{m}_t\}_{t=1}^T$ and $\mathbf{Z} = \{z_t\}_{t=1}^T$.

Now we proceed to integrate out the remaining parameters from the partial marginal likelihood ((ref)), yielding

equation[equation omitted — 329 chars of source]

which lacks a closed-form expression. To tackle this problem, we draw posterior samples using the Gibbs sampler, insert each pair of posterior draws into the partial marginal likelihood ((ref)), and then average across the posterior draws. This effectively integrates out the remaining parameters numerically.

Regimes Estimated

Thus far we have assumed a known number of regimes $G$, as well as known period-by-period values of regimes $z_t\in\{1,2,\cdots, G\}$, $t=1, ..., T$. A realistic treatment, however, requires that regimes be learned from the data, jointly with all model parameters. In this section we present a model-based and macro-instrumented clustering approach to detect regimes. Our approach is model-based since the clusters are chosen according to valuations of the marginal likelihood of the model in Equation ((ref)), and it is macro-instrumented since all clusters are defined explicitly according to values of a set of macroeconomic variables.

The Classification and Regression Tree (CART) of breiman1984classification is one of the most successful machine learning non-parametric regression models for prediction. CART greedily and sequentially partitions data into multiple leaf nodes according to certain decision rules, and then fits a constant to each leaf node for local prediction, thereby approximating curves with locally-constant step functions. We borrow this divide-and-conquer strategy from CART, partitioning the data based on the value of macroeconomic variables to detect regimes. However, a significant distinction lies in our approach's focus on fitting the yields-macro model in Equation ((ref)), where the choice of splitting values is determined by model fitness, specifically, the marginal likelihood of the model. Therefore, we interpret the decision tree more from the perspective of partitioning and identifying regimes rather than merely as a tool for generating step functions for prediction.

figure[figure omitted — 1,274 chars of source]

We present a simple illustrative decision-tree structure in Figure (ref). It consists of two decision rules based on macroeconomic variables, $\mathop{\mathit{FFR}}\nolimits_t \leq 0.6$ and $\mathop{\mathit{INFL}}\nolimits_t$ $\leq 0.4$, representing the fed funds rate and inflation at thresholds of 0.6 and 0.4, respectively. The top node $N_1$ is the “root node". Two split points partition the root node into three regimes, denoted $\{P_1, P_2, P_3\}$ and called “leaf nodes" because they have no further splits. For example, $P_3$ denotes a regime in which the fed funds rate is less than the 60% historical quantile and inflation is higher than the 40% historical quantile, and all the other regimes are interpreted similarly. For each time period $t$, starting from the top node of the decision tree, we compare the values of a set of macroeconomic variables at time $t$ with all decision rules and eventually navigate to one and only one leaf node. The corresponding regime label $z_{t}$ is simply the index of that leaf node.

Estimating the macro-instrumented regime-switching DNS model involves choosing the optimal splitting variables and thresholds from all candidates, along with estimating all parameters of the model in Equation ((ref)). Specifically, when determining the optimal splitting variables, we evaluate the marginal likelihood, as discussed in the previous section, where all other model parameters are integrated out a priori.

Now let us illustrate the splitting algorithm step by step. Before the first split, the root node itself is a leaf node. This means that all time periods are homogeneous, and only one regime encompasses all periods, i.e., $z_t = 1$ for all $t = 1,\cdots, T$. Then, we evaluate whether a split candidate is effective in partitioning the root, as illustrated in Figure (ref).

figure[figure omitted — 994 chars of source]

Suppose that one split candidate based on the fed funds rate, $\mathcal{C}_i {:} \,\mathop{\mathit{FFR}}\nolimits_t \leq 0.6$, partitions the data to two disjoint potential regimes $P_1$ and $P_2$, in which case we update the regime indicators $z_t$ to reflect two regimes, $z_t^{\mathcal{C}_i} = 1$ if $\mathop{\mathit{FFR}}\nolimits_t \leq 0.6$ and $z_t^{\mathcal{C}_i} = 2$ if $\mathop{\mathit{FFR}}\nolimits_t > 0.6$. We denote the new set of regime indicators by $\mathbf{Z}^{\mathcal{C}_i} = \{z_t^{\mathcal{C}_i}\}_{t=1}^T$, where the superscript emphasizes its dependence on specific split candidate $\mathcal{C}_i$.

Importantly, we use the joint marginal likelihood to evaluate Equation ((ref)) with the new regime indicators,

equation[equation omitted — 171 chars of source]

We advocate using the marginal likelihood because it integrates out unknown parameters a priori, accounting for parameter estimation uncertainty when determining regimes. While the yields $\mathbf{Y}$ and the macroeconomic variables $\mathbf{M}$ are fixed, the different split candidates create various regime partitions, yielding different regime indicators $\mathbf{Z}^{\mathcal{C}_i}$ and eventually leading to different evaluations of the split criterion in Equation ((ref)). We loop over all potential macroeconomic split variables and thresholds and pick the first split point as the one with the highest joint marginal likelihood.

figure[figure omitted — 2,225 chars of source]

Once we determine the first split, we determine the second split in similar fashion, as illustrated in Figure (ref), where there are two potential ways to split, given the two leaf nodes created after the first step. The second split can happen at either leaf node created by the first split, and each has multiple potential macroeconomic variables and thresholds. Nevertheless, a candidate $\mathcal{C}_i$ will create one more regime, resulting in a total of three. Let $\mathbf{Z}^{\mathcal{C}_i}$ denote the new regime indicators following the candidate tree structure with three regimes. Thus, the split criterion is defined as $L(\mathbf{Y}, \mathbf{M}, \mathbf{Z}^{\mathcal{C}_i})$ again, which varies with candidates since the indicators change while the yield and macro factors are fixed. We again pick the one with highest marginal likelihood.

All subsequent splits proceed similarly until a pre-specified stopping rule is triggered. In particular, we restrict the number of regimes to be no more than 3, consistent with the existing literature xiang2013regime, and we also require the number of months in a regime to be at least 24 (2 years).

In Algorithm (ref) we provide the pseudocode for determining the macro-instrumented regimes in the yields-macro model. Once the splitting algorithm stops, the regime labels $z_t$ for all time periods are determined explicitly by the tree structure, and we draw posterior samples of all parameters using the Gibbs sampler described in Appendix (ref).

algorithm[algorithm omitted — 1,070 chars of source]
table[table omitted — 4,409 chars of source]

Simulation Evidence

We now assess the efficacy of our Bayesian estimation procedure through a small simulation study based on the three-regime yields-only model in Equation ((ref)). We use the yields-only model ((ref)) -- despite the fact that we generally focus on the yields-macro model (ref) in the rest of the paper -- because it is more tractable for simulation yet equally rich as a testbed for assessing our regime-switching detection and estimation procedure.

We calibrate the underlying true yields-only model parameters using empirical data. We define the true regimes by two macroeconomic variables: the federal funds rate and inflation, covering the period from January 2001 to December 2022, encompassing a total of 264 months. To conduct the simulation, we utilize quantile values of these two variables within a rolling ten-year window. We categorize regimes as follows: in regime 1 the federal funds rate is greater than or equal to 0.6; in regime 2 both the federal funds rate and inflation are less than 0.6; and in regime 3 the federal funds rate is less than 0.6 but inflation is greater than or equal to 0.6.

In keeping with our empirical analysis in the next section, we assume that there are 13 yield maturities: 3, 6, 9, 12, 24, 36, 48, 60, 72, 84, 96, 108, and 120 months. We generate monthly observations on yields with those maturities and perform 100 Bayesian estimation replications. In Table (ref) we present simulation results for the transition matrix $\mathbf{A}$, factor covariance matrix $\mathbf{H}$, and factor mean $\mu$. In each block of the table we report three things: the true parameter value, the mean of the posterior mean estimator across the 100 replications, and the standard deviation of the posterior mean estimator across the 100 replications. For almost all parameters the biases are close to zero, and the standard deviations are small, suggesting that our approach provides accurate estimation of model parameters with endogenously-identified regimes.

Empirical Analysis of U.S. Treasury Yields

We now proceed to an empirical analysis of U.S. Treasury yields, examining regime switching in the yields-macro model (ref). Our primary interests are (1) determining and understanding the regime structure, and (2) characterizing yield-factor and macro-factor interactions, if any, from the perspective of the macro-spanning debate. Most literature on yield-curve regimes considers only two possible regimes, which is potentially quite limiting, and moreover those regimes are latent rather than observed, which creates challenges for both estimation and interpretation.\footnote{See, for example, Dai2007 and hevia2015estimating.} In contrast, we allow for three observable regimes, with clear macroeconomic interpretation. We choose splits sequentially, with the importance of each split decreasing with its order. Hence the first two splits, which define the three regimes, are the most important.\footnote{Our small sample size -- just over 600 months of data, as we will soon discuss -- precludes allowing for more than three regimes, although one could of course do so in principle.}

table[table omitted — 5,760 chars of source]

Data

We use the balanced zero-coupon U.S. Treasury yield data constructed by liu2021reconstructing, which employ a kernel-smoothing method with adaptive bandwidth selection.\footnote{The data are available at \url{https://sites.google.com/view/jingcynthiawu/yield-data}.} The data are monthly, from August 1971 to December 2022, totaling 617 months, and they include 13 maturities of 3, 6, 9, 12, 24, 36, 48, 60, 72, 84, 96, 108, and 120 months.

We show yield data descriptive statistics in Table (ref) and time series in Figure (ref). Among other things, several well-known stylized facts are apparent: (1) yield curves generally slope upward (that is, the average yield generally increases with maturity) but are sometimes inverted; (2) yield volatility decreases with maturity; (3) long-maturity yields are more persistent than short-maturity yields.

figure[figure omitted — 469 chars of source]

We follow diebold2006macroeconomy in using three macroeconomic factors in our yields-macro model: manufacturing capacity utilization ($\mathop{\mathit{CU}}\nolimits_t$), the federal funds rate ($\mathop{\mathit{FFR}}\nolimits_t$), and annual inflation ($\mathop{\mathit{INFL}}\nolimits_t$).\footnote{All are from the Federal Reserve Economic Data (FRED) database of the Federal Reserve Bank of St. Louis, at \url{https://fred.stlouisfed.org/}.} Standardized versions of those variables also serve as the candidate split variables for classifying macroeconomic regimes. In particular, for regime classification we standardize the split variables on a rolling window basis, replacing them with their quantiles based on historical ten-year rolling-windows, so that they lie in $[0, 1]$, and we use 0.2, 0.4, 0.6, and 0.8 as the candidate split thresholds. Our use of quantiles ensures that the splits are meaningful and comparable across space and time.\footnote{We emphasize that yields-macro model estimation we leave the macroeconomic variables at their original, unstandardized, values, as appropriate. We convert to rolling quantiles only for regime classification using algorithm (ref).}

Yields-Macro Model Estimation

In this section we present empirical results for the yields-macro regime-switching model in Equation ((ref)). Our first key result is that there is indeed evidence for regime switching, as evidenced by the three-regime model favored by the marginal likelihood. As we show in the left panel of Figure (ref), the first identified split is on $\mathop{\mathit{FFR}}\nolimits_t$ (federal funds rate) at a threshold of 0.6, and the second is on $\mathop{\mathit{INFL}}\nolimits_t$ (inflation), also at a threshold of 0.6. The two splits create three regimes, Regime 1 ($\mathop{\mathit{FFR}}\nolimits_t$ $\geq$ 0.6) with 191 months, Regime 2 ($\mathop{\mathit{FFR}}\nolimits_t$ $<$ 0.6 & $\mathop{\mathit{INFL}}\nolimits_t$ $<$ 0.6) with 310 months, and Regime 3 ($\mathop{\mathit{FFR}}\nolimits_t$ $<$ 0.6 & $\mathop{\mathit{INFL}}\nolimits_t$ $\geq$ 0.6) with 116 months. In the right panel of Figure (ref) we present the three estimated time series of yield factors, with shaded background regions denoting the three identified regimes.

figure[figure omitted — 1,766 chars of source]

In Table (ref) we present the posterior means and standard deviations of the model parameters for the three regimes, which brings us to our second key result: there is regime-specific evidence both for and against macro-spanning. In Regimes 2 and 3, the estimated transition matrix $\mathbf{A}$ shows little or no effects of macro factors on yield factors, suggesting that the macro factors have little or no predictive value for the yield curve, so that macro spanning seems to be a reasonable approximation to the yields-macro dynamics in Regimes 2 and 3. In contrast, however, in Regime 1, which features high federal funds rates, we find a significant positive effect of inflation on the curvature factor, so that macro spanning is violated.

table[table omitted — 12,048 chars of source]

In Figure (ref) we compare aspects of the average actual and fitted yield curves. In red we show the pair of yield curves averaged across all regimes. The actual and fitted curves are very close, indeed almost identical at all but the shortest maturities, so the model fitting errors are generally very small. The remaining three pairs of curves correspond to the three regimes. First and very importantly, within each regime, the actual and fitted curves are very close, again almost identical at all but the shortest maturities. Second and equally importantly, across the regimes, the three curve pairs are very different, underscoring the presence of three regimes and the distortions that would likely be caused if one were to insist on a one-regime model, as confirmed in the one-regime estimation results of Table (ref), in which macro factors have no significant effects on yield factors.

figure[figure omitted — 547 chars of source]
table[table omitted — 4,683 chars of source]

Comparing Regimes

Now we explore the three detected regimes in greater detail. We focus on factor dynamics, which are determined by the transition matrix $\mathbf{A}$ and factor innovation covariance matrix $\mathbf{H}$. We first compare posterior distributions of elements of the $\mathbf{A}$ and $\mathbf{H}$ matrices across regimes (including formal tests for equal posterior means), and then we compare impulse-response functions.

Posterior Distributions

Here we compare posterior densities of estimated $\mathbf{A}$ and $\mathbf{H}$ parameters across different regimes. Given their importance in determining the factor dynamics, we focus on the diagonal elements, denoted by $A_{i,i}$ and $H_{i,i}$, respectively.

figure[figure omitted — 3,099 chars of source]

In Figure (ref) we show posterior density plots for the yields-macro model parameters across the identified regimes. The plots reveal distinct posterior patterns for all parameters in each regime. For example, while Regimes 2 and 3 exhibit similar posterior densities for $A_{1,1}$ (representing level dynamics), they differ markedly for $A_{2,2}$ and $A_{3,3}$ (representing slope and curvature dynamics, respectively). Notably, the factor innovation covariance matrices also display substantial variation across regimes, with the posterior densities of the diagonal elements of $\mathbf{H}$ showing minimal overlap, indicating important changes across regimes.

table[table omitted — 4,684 chars of source]

To further examine the differences among detected regimes, we implement two-sample t-tests if inter-regime equality of posterior means of the elements of $\mathbf{A}$ and $\mathbf{H}$, again focusing on their diagonal elements. The sample sizes are equal across regimes, reflecting the uniform posterior sample size $n_s$ used in the Gibbs sampler, but, given the potential for heterogeneous variances among regimes, we implement tests that accommodates unequal variances $s_1^2$ and $s_2^2$. The t-statistic is

equation*[equation* omitted — 62 chars of source]

where $$s_{\Delta} = \sqrt{\frac{s_1^2 + s_2^2}{n_s}},$$ with associated degrees of freedom $\frac{(n_s-1)(s_1^2 + s_2^2)^2}{s_1^4 + s_2^4}$. We present the t-test results for the three-regime yields-macro DNS model in Table (ref). They clearly indicate that the three identified regimes are distinct.

Impulse Response Functions

figure[figure omitted — 1,548 chars of source]

Impulse response functions (IRFs) have been used at least since sims1980macroeconomics to quantify the dynamic effects of shocks. Our focus is on cross-regime differences in impulse responses in the three-regimes yields-macro DNS model, with particular attention to macro-spanning. In Figure (ref), we show “yields-to-macro" and “macro-to-yields" IRFs and credible bands.\footnote{We use generalized impulse response functions koop1996impulse because they are invariant to variable ordering.}

Let us discuss the IRFs in reverse order of regimes, beginning with regime 3 (low $FFR$, high $INFL$). In regime 3 the IRFs behave as expected under macro spanning. That is, there are clear yields-to-macro responses but little or no macro-to-yields responses. In regime 2 (low $FFR$, low $INFL$), the IRFs also support macro spanning insofar as there are no important macro-to-yields responses. At the same time, however, there are also no important yields-to-macro responses; that is, causal shock transmission is weak in both directions. Finally, in regime 1 (high $FFR$). There is clear violation of macro spanning due to sizable macro-to-yields effects, with $FFR$ affecting all yield factors, and $CU$ affecting the curvature factor, again suggesting that macro spanning (or lack thereof) is a regime-specific phenomenon.

Conclusion

We explore tree-based macroeconomic regime-switching in the context of the “yields-macro" version of the dynamic Nelson-Siegel (DNS) yield-curve model. By integrating decision trees from machine learning, our approach customizes the tree-growing algorithm to partition macroeconomic variables based on the DNS model's Bayesian marginal likelihood, enabling us to identify regime-shifting patterns in the yield curve. Compared to traditional Markov-switching models, this “macro instrumented" approach offers clear economic interpretation via macroeconomic linkages and ensures computational simplicity.

We provide a detailed empirical analysis of the U.S. Treasury yield curve, August 1971 - December 2022. There are several findings. First, the macro-instrumented approach clearly identifies regime-switching behavior based on the yields-macro models, fitting the data well. Second, the regimes are primarily driven by the federal funds rate, which captures the central bank (in our application, the U.S. Federal Reserve) policy stance. Third, we identify a regime with high federal funds rate, in which the macroeconomy contains useful information about the future yield curve, whereas in other regimes the macroeconomy contains little or no information about the future yield curve.

Overall, then, our results indicate not only that yields clearly and consistently help to forecast the aspects of the macroeconomy, but also that aspects of the macroeconomy sometimes help to forecast yields. That is, our results suggest that “macro spanning" may hold in some regimes but fail in others. Financial economic and econometric yield-curve modeling may therefore benefit from a more nuanced re-orientation, working not in environments where macro spanning “holds" or “fails", but rather in environments where it sometimes holds and sometimes fails.