SSVS for VARs — Bayesian Restriction Search

Python · R · Part 3 of the variable-selection arc — restriction search on a system

Overview

Part 3 of the variable-selection arc: restriction search on a whole system. An unrestricted VAR is famously over-parameterised — with mm variables and pp lags the system has m2pm^2p coefficients plus a full covariance matrix. George, Sun & Ni (2008) turn Part 1's spike-and-slab idea loose on exactly this, and distinctively select on two fronts at once: the VAR coefficients BB (which lag relationships are real) and the off-diagonals of the error precision's Cholesky factor Ψ\Psi where Σ1=ΨΨ\Sigma^{-1}=\Psi\Psi' (which contemporaneous links are real). Every free element gets a latent 0/1 indicator and a spike-and-slab prior; a Gibbs sampler sweeps them, and the posterior inclusion probabilities read out the restrictions the data support. Fit from scratch to a canonical three-variable US monetary VAR (GDP growth, CPI inflation, the 3-month T-bill rate; 1959–2009) — the SSVS counterpart to the shrinkage priors (Minnesota, horseshoe) used elsewhere for large VARs, and the only method in the series that prunes the error covariance as well as the mean.

Y=XB+E,EtN(0,Σ),  Σ1=ΨΨ;γiB,ωijΨi<jY = XB + E,\quad E_t\sim\mathcal N(0,\Sigma),\ \ \Sigma^{-1}=\Psi\Psi'; \qquad \gamma_i \to B,\quad \omega_{ij} \to \Psi_{i<j}

Two spike-and-slab layers, four Gibbs blocks

Two spike-and-slab layers over the reduced-form VAR Y=XB+EY=XB+E. Coefficients: each element of β=vec(B)\beta=\mathrm{vec}(B) carries an indicator γi\gamma_i with a narrow spike / wide slab and γiBernoulli(w)\gamma_i\sim\text{Bernoulli}(w). Error structure: factor the precision Σ1=ΨΨ\Sigma^{-1}=\Psi\Psi' with Ψ\Psi upper-triangular; the free off-diagonals ηij\eta_{ij} — the contemporaneous conditional dependence between equations — get their own spike-and-slab with indicators ωij\omega_{ij}, so selecting ωij=0\omega_{ij}=0 says variables ii and jj are contemporaneously conditionally independent. The scales are semiautomatic: tied to each coefficient's OLS standard error (κ0i=c0s^i\kappa_{0i}=c_0\hat s_i, κ1i=c1s^i\kappa_{1i}=c_1\hat s_i, with c0=0.1,c1=10c_0=0.1, c_1=10), so "small" and "large" are measured in units of sampling variability for every coefficient automatically. One Gibbs sweep cycles four closed-form blocks: (1) the coefficients β\beta as a vectorised GLS draw; (2) their indicators γi\gamma_i from the spike/slab density ratio; (3) the error factor Ψ\Psi drawn column by column from the exact Cholesky-of-precision update; (4) the link indicators ωij\omega_{ij}. Steps 1–2 are Part 1's SSVS vectorised; steps 3–4 are the new covariance-selection layer. The engine is a self-contained gsnvar.py.

Results

The search recovers textbook macro dynamics. In the GDP-growth equation its own first lag dominates (0.95); the inflation equation is strongly autoregressive; and the T-bill equation keeps its own lag and loads on lagged output and inflation — a Taylor-rule-like reaction function, discovered, not imposed. About half the lag coefficients are switched off — cross-variable terms with no support pushed into the spike — substantially sparsifying the VAR, exactly the over-parameterisation cure. Contemporaneous structure is selected too: the Ψ\Psi off-diagonals keep ffr↔infl (1.00) and ffr↔dlgdp (0.75) but drop infl↔dlgdp (0.20) — conditional on the interest rate, output and inflation innovations are close to contemporaneously independent. Selection, not just shrinkage: unlike a continuous global-local prior (the horseshoe), SSVS returns genuine 0/1 restrictions and their probabilities — a posterior over VAR specifications — and unlike every earlier selection method here, it prunes the error covariance as well. The bespoke Gibbs and a PyMC spike-and-slab agree on which coefficients survive; the PyMC run mixes far less efficiently (discrete indicators under a full multivariate-normal likelihood), which is precisely why George–Sun–Ni derive a dedicated closed-form Gibbs sampler. Cross-checked further against a from-scratch base-R re-implementation.

Notebooks

Downloads

References