Quantitative Research · Theory & Methods

State-Space Formulation,
Inference & Crisis Prediction

Mathematical foundations of latent_liquidity_quant — covering the hidden state model, observation equations, particle filter inference, and forward crisis probability estimation.

Section 01

Model Overview

The latent-liquidity model detects and forecasts financial crises by inferring a hidden liquidity factor that drives volatility, cross-asset correlations, and credit risk. A state-space framework captures the temporal evolution of these hidden drivers while linking them to observed market data — enabling both filtering (past/present state estimation) and forecasting (future crisis probability) within a coherent probabilistic model.

Section 02

State-Space Model Structure

Latent State Vector

The three-dimensional latent state at time \(t\) is:

State definition
$$ x_t = [L_t,\; h_t,\; z_t]^\top $$
\(L_t\)
Latent liquidity / systemic stress factor — rises during funding crunches and spread widening events.
\(h_t\)
Log-volatility: instantaneous variance is \(\sigma_t^2 = e^{h_t}\). Log parameterisation guarantees positivity without constraint.
\(z_t\)
Latent correlation driver: \(\rho_t = \tanh(z_t)\) maps \(\mathbb{R}\) to \((-1,1)\), ensuring valid correlation values at all times.

Transition Dynamics

Each latent state evolves as an autoregressive stochastic process, allowing regime persistence and mean reversion:

State transition equations
$$ \begin{aligned} L_{t+1} &= \phi_L\, L_t + \beta_L\, e^{h_t} + \epsilon_L \\[4pt] h_{t+1} &= \mu_h + \phi_h\,(h_t - \mu_h) + \epsilon_h \\[4pt] z_{t+1} &= \phi_z\, z_t + \gamma\, L_t + \epsilon_z \end{aligned} $$

Process noises \(\epsilon_L, \epsilon_h, \epsilon_z \sim \mathcal{N}(0, \sigma^2)\) allow stochastic regime shifts. The coupling \(\beta_L e^{h_t}\) in the liquidity equation means rising volatility feeds directly into stress — capturing the empirical liquidity-volatility spiral.

Observation Model

The observable vector at each time step is:

Observation vector
$$ y_t = [r_{\text{SPY}},\; r_{\text{TLT}},\; r_{\text{HYG}},\; \text{VIX}_t,\; \text{Spread}_t,\; \text{Corr}_t] $$

Each observable links to the latent state through a dedicated measurement equation:

Measurement equations
$$ \begin{aligned} r_t &\sim \mathcal{N}\!\left(0,\; \Sigma_t\right), \quad \Sigma_t = e^{h_t} R(\rho_t) \\[6pt] \text{VIX}_t &\sim \mathcal{N}\!\left(a_{\text{vix}} + b_{\text{vix}}\, e^{h_t/2},\; \sigma_{\text{vix}}^2\right) \\[6pt] \text{Spread}_t &\sim \mathcal{N}\!\left(a_{\text{sp}} + b_{\text{sp}}\, L_t,\; \sigma_{\text{sp}}^2\right) \\[6pt] \text{Corr}_t &\sim \mathcal{N}\!\left(a_{\text{corr}} + b_{\text{corr}}\, \rho_t,\; \sigma_{\text{corr}}^2\right) \end{aligned} $$

where \(R(\rho_t)\) is an equicorrelation matrix with off-diagonal entries \(\rho_t = \tanh(z_t)\).

Section 03

Data Inputs

Six market observables are used, each targeting a distinct dimension of systemic risk:

SPY
Equity returns — broad market risk appetite proxy. Loaded into \(\Sigma_t\) via \(e^{h_t}\).
TLT
Long-duration Treasury returns — flight-to-quality and interest rate risk proxy.
HYG
High-yield corporate bond returns — funding stress and credit risk signal linked to \(L_t\).
VIX
CBOE implied volatility index — observed proxy for latent log-volatility \(h_t\).
Spread
Credit/OAS spread — widens as liquidity deteriorates; directly regressed on \(L_t\).
Corr
30-day rolling cross-asset correlation — captures market co-movement driven by \(\rho_t = \tanh(z_t)\).
Section 04

Inference Method

The non-linear observation equations make the posterior intractable in closed form. Latent states are therefore inferred using Sequential Monte Carlo (particle filtering), which approximates the filtering distribution as a weighted empirical measure:

Particle filter posterior approximation
$$ p(x_t \mid y_{1:t}) \;\approx\; \sum_{i=1}^{N} w_t^{(i)}\, \delta\!\left(x_t - x_t^{(i)}\right) $$
Step 01
Prediction
Propagate each particle \(x_{t-1}^{(i)}\) forward through the transition model to obtain prior samples \(\tilde{x}_t^{(i)}\).
Step 02
Weighting
Compute unnormalised importance weights \(w_t^{(i)} \propto p(y_t \mid \tilde{x}_t^{(i)})\) via the observation likelihood.
Step 03
Resampling
Resample particles proportional to \(w_t^{(i)}\) to concentrate mass on high-likelihood regions and prevent weight degeneracy.

Posterior summaries — means and 5th/95th percentile bands for \(L_t, h_t, z_t\) — are saved to results/crisis_res.npz and visualised in the interactive dashboard.

Section 05

Crisis Prediction Methodology

Forward crisis probabilities are produced by extending the particle filter into a Monte Carlo forecasting step. For a horizon of \(H = 60\) trading days:

  1. Sample a set of particles from the current filtering posterior \(p(x_t \mid y_{1:t})\).
  2. Simulate each particle forward \(H\) steps using the transition dynamics, accumulating stochastic paths.
  3. Aggregate crisis risk metrics across paths — e.g. \(P(L_{t+H} > L_{\text{crit}})\), tail stress quantiles, and composite risk signals.
60-day forward crisis probability
$$ P_{\text{crisis}}(t) = P\!\left(L_{t+60} > L_{\text{crit}} \;\middle|\; y_{1:t}\right) \;\approx\; \frac{1}{N}\sum_{i=1}^{N} \mathbf{1}\!\left[L_{t+60}^{(i)} > L_{\text{crit}}\right] $$

These forward simulations produce probabilistic crisis cones. The tail probability \(P(L_t > 2)\) is also tracked at each time step as a contemporaneous stress indicator, shown as the orange bar overlay in the dashboard's stress chart.

Section 06

Interpretation

The three latent factors jointly cover the main channels of systemic risk:

↑ \(L_t\)
Liquidity spiral: rising stress signals funding pressure, spread widening, and deteriorating market depth. The primary crisis indicator.
↑ \(h_t\)
Volatility clustering: persistent high log-volatility captures risk-on/off cycles. Feeds back into \(L_{t+1}\) via the \(\beta_L e^{h_t}\) coupling.
↑ \(\rho_t\)
Correlation breakdown: when \(z_t\) is high, cross-asset correlations approach 1, reflecting the loss of diversification typical of systemic stress episodes.

Jointly, these mechanisms provide early-warning signals of systemic instability — the model identifies stress build-up days to weeks before peak realised volatility, as visible in the 2008 GFC and COVID-19 windows in the dashboard.

Section 07

Vanguard Risk Evolution — Full Series

Animated output from experiments/animate_crisis.py — showing how the three latent factors and crisis probability evolve over the full sample. Watch for the sharp spikes aligning with the 2008 GFC, 2020 COVID onset, and 2022–23 tightening cycle.

Vanguard risk evolution — animated full series