BVAR with Stochastic Volatility

Python · R · Part 4 of the VAR arc

Overview

Part 4 of the VAR arc: time-varying volatility. Every VAR so far — through the large 20-variable system of Part 3 — assumed a constant shock covariance Σ\Sigma, treating the economy as equally turbulent in 1974, 1998 and 2008. That is plainly false: US macro data went through a Great Moderation — a sharp, lasting fall in the volatility of output, inflation and interest rates around 1984 — bracketed by the turbulent 1970s and the 2008 crisis. A fixed-Σ\Sigma VAR splits the difference, so its forecast intervals are simultaneously too wide in calm times and too narrow in storms — its risk assessments are wrong exactly when they matter. Stochastic volatility (SV) lets the shock variances follow their own process, and the literature (Clark 2011; D'Agostino–Gambetti–Giannone 2013) finds it delivers most of the gain from time-varying models — more than letting the regression coefficients drift. This example adds SV to the monetary BVAR from scratch in NumPyro, holding the coefficients constant so the volatility is the whole story.

Σt=A1diag ⁣(eh1,t,,ehm,t)A,hi,t=hi,t1+ηi,t,ηi,tN(0,σi2)\Sigma_t = A^{-1}\operatorname{diag}\!\big(e^{h_{1,t}},\dots,e^{h_{m,t}}\big)A^{-\top}, \qquad h_{i,t} = h_{i,t-1} + \eta_{i,t}, \quad \eta_{i,t}\sim\mathcal N(0,\sigma_i^2)

Factoring the time-varying covariance

The covariance is factored through a constant unit-lower-triangular AA and a time-varying diagonal (Cogley–Sargent 2005; Primiceri 2005): Aεt=utA\varepsilon_t = u_t orthogonalises the reduced-form shocks into mm independent structural components, each carrying its own log-variance hi,th_{i,t} that drifts as a driftless random walk. Because AA has ones on the diagonal, A=1|A|=1, so the change of variables from εt\varepsilon_t to utu_t has unit Jacobian and the likelihood is just a product of mm univariate Gaussians — no determinant term. The coefficients keep the same Minnesota prior (via bvar.py, λ1=0.2\lambda_1=0.2), but with own_mean = 0: the data are stationary growth rates, so the prior shrinks toward white noise, not a random walk. The whole model — VAR coefficients, AA, and the T×mT\times m log-volatility surface — is sampled jointly by NUTS, with the random walk written in non-centred form hi,=hi,0+σicumsum(zi)h_{i,\cdot}=h_{i,0}+\sigma_i\operatorname{cumsum}(z_i) to kill the volatility-of-volatility funnel that otherwise cripples HMC (R^=1.001\hat R = 1.001, min ESS ~890).

Results

The volatility paths write the postwar history plainly. All three shock volatilities are high and choppy through the 1970s and early 1980s, then drop to a low, stable plateau after ~1984 and stay there — the Great Moderation, with the constant-Σ\Sigma line sitting uselessly in between. interest-rate volatility peaks in the 1979–82 Volcker disinflation (output-growth volatility a little earlier, in the turbulent late 1970s), inflation volatility peaks with the 1974 oil shock, every series flares in 2008, and the funds-rate volatility collapses toward zero after 2008 when the policy rate was pinned at the zero lower bound. SV massively improves fit — the in-sample log-likelihood rises by ~300 moving from constant variance to SV — and a standardization test confirms it: dividing each shock by its SV path whitens it to a flat rolling std near 1, while dividing by a constant std leaves the heteroskedasticity glaring. The practical payoff is calibrated forecast uncertainty: the SV-VAR's predictive intervals widen in the 1970s and 2008 and narrow through the Great Moderation, so its probability statements are honest in every regime. All of this from time-varying volatility alone — the coefficients never moved (that comes in Part 5, the time-varying-parameter VAR). Cross-checked in R from the opposite direction — a stationary AR(1) SV fit to the OLS residuals with stochvol — which recovers the same Great-Moderation collapse and the same crisis spikes, confirming the path is in the data, not the prior.

Notebooks

Downloads

References