EconBase
← Back to paper

Machine Learning the Macroeconomic Effects of Financial Shocks

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.

18,685 characters · 5 sections · 24 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 the Macroeconomic Effects of Financial Shocks

\thispagestyle{empty}

center[center omitted — 700 chars of source]

\spacing{1.5}

Introduction

Extreme financial shocks such as the bankruptcy of Lehman Brothers in September 2008 have the potential to trigger substantial nonlinear reactions on the real side of the economy. These nonlinearities appear in terms of size, sign and state dependence brunnermeier2014macroeconomic. These asymmetric effects, however, often arise from assuming particular functional relations for the conditional mean part of the model and are thus inherently model-dependent. In this note, we solve this issue by “machine learning" the nonlinear effects of financial shocks on US macroeconomic aggregates using Bayesian neural networks.

Existing studies learn the domestic effects of financial shocks either through flexible nonlinear parametric models barnichon2022effects or through nonparametric techniques mumtaz2022impulse. In this note, we propose using Bayesian Neural Networks (BNNs), a model that has, so far, demonstrated its effectiveness in forecasting hauzenberger2024BNN. By basing local projections on BNNs, we gain additional flexibility in modeling nonlinearities and address the common criticism of black-box models as being unsuitable for structural economic analysis, demonstrating that BNNs can offer meaningful insights into economic dynamics.

We use BNNs as developed in hauzenberger2024BNN to investigate how key US macroeconomic quantities react to a financial shock, and assess whether the reactions are non-proportional with respect to the size and asymmetric with respect to the sign of the shock. Specifically, we develop BNN-based nonlinear local projections jorda2005estimation and investigate how financial shocks --- measured with the excessive bond premium gilchrist2012credit --- impact US inflation, industrial production, and employment. We find substantial asymmetries with respect to sign, with negative shocks exerting stronger effects than positive ones, but substantial proportionality with respect to the size of the shock.

The note is structured as follows. Section (ref) gives a short introduction to Bayesian Neural Networks. Section (ref) develops nonlinear local projections for BNNs. Section (ref) presents the propagation of financial shocks via our nonlinear framework. Section (ref) concludes.

Bayesian Neural Networks (BNNs)

We follow hauzenberger2024BNN and use Bayesian Neural Networks (BNNs) to introduce nonlinearities into a general regression model given by:

align[align omitted — 302 chars of source]

where $\bm \gamma$ denotes linear coefficients of dimension $K$, and $\varepsilon_t$ is a Gaussian shock with zero mean and time-varying variance $\sigma_t^2$.\footnote{The error variance is modeled via stochastic volatility, as in kastner2014ancillarity.} We allow for $L$ hidden layers and $Q_\ell~(\ell=1, \dots, L)$ neurons in each layer. By recursively applying nonlinear transformations to the neurons of the previous layer, we move from covariates $\bm x_t$ to $f(\bm x_t)$, the output of the final layer. These transformations are implemented via activation function $h_{\ell, q}~(q=1, \dots, Q_\ell)$, which in the case of hauzenberger2024BNN can be layer and neuron-specific (i.e., $\bm h_\ell = (h_{\ell, 1}, \dots, h_{\ell, Q_\ell})'$).\footnote{Note that this discussion abstracts from the bias term to simplify notation. In our empirical application, we include the bias term, which in a neural network, allows the activation function to be shifted towards positive and negative values.} The network coefficients are stored in $\bm W_\ell$ for $\ell=2,\dots,L$ with dimension $Q_\ell \times Q_{\ell-1}$, in $\bm W_{L+1}$ as a $1 \times Q_L$ vector and $\bm W_1$ as a $Q_1 \times K$ matrix.

To address the sharp increase in the number of coefficients with more complex network structures, we introduce regularization via a global local shrinkage prior in the form of the horseshoe prior carvalho2009handling,ghosh2019model,bhadra2020horseshoe. In this setup, each element of $\bm w_{\ell, i \bullet} = (w_{\ell, i1}, \dots, w_{\ell, i Q_{\ell -1}})'$, with $\bm w_{\ell, i \bullet}$ denoting the $i^{th}$ row of $\bm W_\ell~(\ell=1, \dots, L+1)$ follows:

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

The global (neuron-specific) shrinkage parameter $\lambda^2_{{\ell, i}}$ forces all elements in $\bm w_{\ell, i \bullet}$ towards zero, while the local scaling parameter $\varphi_{\ell, ij}$ allows for coefficient-specific shrinkage. Accordingly, we apply the horseshoe prior to the linear coefficients $\bm \gamma$.

One important specificity of the network structure is that it allows for a mixture specification, averaging over four different activation functions. We define $h^{(m)}$ as one out of $m \in \{\text{leakyReLU}, \text{sigmoid}, \text{ReLU}, \text{tanh}\}$ activation functions and let each be given by:

equation[equation omitted — 115 chars of source]

with $z_{\ell q, t}$ denoting the $q^{th}$ element in the recursively defined vector $\bm z_{\ell, t} = \bm W_{\ell} \bm h_{\ell-1}( \bm z_{\ell-1, t})$ and $\bm z_{1, t} = \bm W_1 \bm x_t$. Weights ${\omega}^{(m)}_{\ell, q}$ are constrained to satisfy ${\omega}^{(m)}_{\ell, q} \ge 0$ and $\sum_m {\omega}^{(m)}_{\ell, q} = 1$. The prior on $\omega^{(m)}_{\ell, q}$ is set in an uninformative manner with a prior probability of $\text{Prob}(\delta_q = m) = 1/4$.

For posterior inference, we use an MCMC algorithm structured into multiple blocks, iterated 20,000 times with the initial 10,000 draws discarded as burn-in. In brief, we start by drawing the linear coefficients $\bm \gamma$ and the nonlinear coefficients of the last layer $\bm W_{L+1}$ jointly from a standard multivariate Gaussian posterior. The remaining coefficients $\bm W_\ell| \bullet$, for $\ell = 1, \dots, L$ are obtained via an HMC step neal2011hmc. All shrinkage hyperparameters are updated by sampling from inverse Gamma distributions using the sampler as in makalic2015simple. Finally, to simulate the activation function $h_{\ell, q}$, we draw the indicator $\delta_{\ell, q}$ from a multinomial distribution. $\delta_{\ell, q}$ takes integer values from one to four, each corresponding to a specific activation function selected from the predefined set. For technical details we refer to hauzenberger2024BNN.

Nonlinear local projections in BNNs

In the literature, there is substantial evidence of asymmetric effects of benign versus adverse financial shocks on the economy balke2000credit,brunnermeier2014macroeconomic,barnichon2022effects. To shed light on this issue, we develop nonlinear local projections mumtaz2022impulse, gonccalves2024state, inoue2024local for BNNs.

Let $\zeta_t$ denote an exogenous instrument for a shock of interest. Adding $\zeta_t$ to our general nonlinear regression problem and iterating $y_t$ $h$-periods forward (for $h=0,\dots, H$), yields:

equation[equation omitted — 193 chars of source]

Here, for $h \ge 1$ we let $\bm \epsilon_{t+h} = (\varepsilon_{t}, \dots, \varepsilon_{t+h-1})'$ denote a $h$-dimensional vector of shocks for periods $t,\dots, t+h-1$, and $ \tilde{\bm \gamma}_h$ a $h$-dimensional vector of associated coefficients. For $h=0$, no shocks are included. Note that $\psi_h, \bm \gamma_h, \tilde{\bm \gamma}_h$ and $f_h$ are horizon-specific.

We obtain the nonlinear local projections in two steps kilian2017structural. First, we obtain the NLP conditional on the full history of the data $\bm \Omega_{t}$ up to time $t$ (which includes the instrument, past shocks and covariates) by computing the difference between the expectation of Eq. ((ref)) given $\zeta_t = \tau$ and the expectation given $\zeta_t = 0$:

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

Second, this NLP depends on the observed data $\bm \Omega_{t}$. A more general way of representing the nonlinear response of the economy to a financial shock can be obtained by considering the unconditional NLP obtained as:

equation[equation omitted — 124 chars of source]

where, as in kilian2017structural, $\bm \Omega^r_{t}$ is a randomly selected path of observations.

This quantity can be computed for each MCMC draw of $\psi_h, \bm \gamma_h, \tilde{\bm \gamma}_h $ and $\widehat{f}_h$ (the trained BNN approximation to $f_h$), yielding a posterior distribution over impulse responses to financial shocks. Specifically, for each MCMC draw we compute NLP$(h, \tau, \bm \Omega_{t})$ for $R$ different realizations of $\bm \Omega_{t}^r$ and take the mean:

equation[equation omitted — 114 chars of source]

Setting $R = 400$ to a large value yields a precise approximation to the integral in Eq. ((ref)).

An additional complication to compute NLP($h, \tau$) is that $\bm \epsilon_{t+h}$ in Eq. ((ref)) is latent.\footnote{In an extensive robustness check, clark2024investigating show that of $\bm \epsilon_{t+h}$ only has a small impact on direct forecasts.} Within a linear framework, lusompa2023local proposes estimating $\bm \epsilon_{t+h}$ using the estimated residuals and then treating them as fixed regressors.

Yet, in a nonlinear framework, ignoring uncertainty surrounding $\bm \epsilon_{t+h}$ can generate bias. Hence, we follow an alternative, sequential approach which exploits the Bayesian nature of our method. More specifically, in a first step we estimate the regression in Eq. ((ref)) for $h=0$, save the posterior distribution of the shock $\varepsilon_t$. Second, we estimate the model for $h=1$, replacing $\epsilon_{t+1}$ in each draw of the Gibbs sampler by a draw $\epsilon^{(j)}_{t+1}=\varepsilon^{(j)}_t$ from $p(\epsilon_{t+1}|\bullet)$ for each $t$. This yields a shock distribution of $p(\varepsilon_{t+1}|\bullet)$. Third, we estimate the model for $h=2$ replacing $\bm \epsilon_{t+2}$ by $\bm \epsilon^{(j)}_{t+2} = (\varepsilon^{(j)}_t, \varepsilon^{(j)}_{t+1})' \sim p(\varepsilon^{(j)}_t, \varepsilon^{(j)}_{t+1}|\bullet)$ for each $t$. This procedure is repeated until we end up estimating the regression for horizon $H$.

The nonlinear effects of financial shocks

We focus on how financial shocks impact inflation, output and employment, and whether these effects are symmetric and proportional. To answer these questions, we employ a BNN featuring one hidden layer and $Q=K$ neurons. Building on the existing literature gilchrist2012credit,barnichon2022effects,mumtaz2022impulse, we construct our dataset using variables from FRED-MD mccracken2016fred, including inflation (CPIAUCSL), employment (CE16OV), industrial production growth (INDPRO) as well as the federal funds rate (FEDFUNDS) and stock market returns (S.P.500). In addition, we also include a proxy of the financial shock. This proxy is obtained by including the excess bond premium gilchrist2012credit in a structural VAR that uses the same five variables as well as the EBP. We order the EBP measure first and obtain the structural economic shock related to this variable, which can be interpreted as a financial shock. The sample ranges from January 1960 to December 2020.

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

Figure (ref) shows the 16$^{th}$ and 84$^{th}$ percentiles of the posterior distribution of the LPs (shaded areas) and the median (solid lines) for different shock signs and shock sizes. Panel (a) shows the responses of inflation, IP and employment to a one unit contractionary financial shock (in red) and to a benign financial shock (in green). The benign shock is multiplied by $-1$ to simplify comparison. Panel (b) shows the responses to a contractionary financial shock to a one and three unit financial shock. The three unit shock is re-scaled by $1/3$ to ease comparison.

The figure reveals substantial asymmetries with respect to the sign of the shock. Consistent with the literature barnichon2016theory,barnichon2022effects,forni2024nonlinear, we find that contractionary shocks have much stronger effects on the macro aggregates than benign shocks. Starting with inflation reactions, we find that contractionary financial shocks exert downward pressure on prices. This effect is strong and peaks after around one month, with a peak median decline in inflation of around one percentage point. Notice that the reaction is also quite persistent and turns insignificant only after around 18 months. By contrast, a benign shock leads to a much weaker reaction of inflation. After around seven months (until around 1.5 years), there is some evidence that inflation picks up. But apart from this, the credible intervals mostly include zero.

We now turn to the reaction of IP growth. Output seems to react sluggishly with respect to financial shocks. The declines in output growth are much stronger if the shock is adverse, reaching almost two percentage points after around eleven months. For a benign shock, the effects are much more muted and (almost) never significant.

Similar to the inflation reaction, we find that employment growth strongly declines after a negative financial shock. This decline peters out after around two years, turning insignificant afterwards. The sharp drop in prices can be linked to the decline in employment and the associated downward pressure on wages. Again, we find no discernible reaction to a benign shock.

In terms of size asymmetries (panel (b) of Figure (ref)), we find that contractionary financial shocks of different sizes (one and three units) trigger proportional reactions of all three focus variables under consideration.

Conclusion

We exploit Bayesian neural networks to compute non-parametric impulse response functions, and applies the method to approximate the reaction of three ley US macroeconomic variables to financial shocks. We find that asymmetries arise mostly with respect to the sign of the shocks. Adverse financial shocks have a tendency to trigger much stronger reactions of inflation, industrial production and employment than benign shocks. When it comes to asymmetries with respect to size, we instead find no differences, with small and large shocks resulting in almost exactly proportional impulse responses.

{\setstretch{0.85} \addcontentsline{toc}{section}{References} }