Mathematical foundations of latent_liquidity_quant — covering the hidden state model,
observation equations, particle filter inference, and forward crisis probability estimation.
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.
Goal: estimate latent market stress and produce probabilistic crisis warnings with calibrated uncertainty.
Why SSM: liquidity conditions are unobserved; state-space models naturally separate latent dynamics from noisy measurements and support sequential Bayesian updates without reprocessing the full history at each step.
Output: posterior means and 90% credible intervals for \(L_t\), \(h_t\), \(z_t\), plus 60-day forward crisis probabilities.
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:
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.
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:
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:
Sample a set of particles from the current filtering posterior \(p(x_t \mid y_{1:t})\).
Simulate each particle forward \(H\) steps using the transition dynamics, accumulating stochastic paths.
Aggregate crisis risk metrics across paths — e.g. \(P(L_{t+H} > L_{\text{crit}})\), tail stress quantiles, and composite risk signals.
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.