Rasmus Suonio

Six tests of market contagion: no early warning, adaptive models win

A reproducible platform for how shocks spread across US stocks, rates, credit, currencies and commodities, with every claim labelled descriptive, predictive or causal.

Done Nov 2026
Connectedness before crises
No reliable rise (placebo p 0.47)
Stress-day error, EWMA vs static network
−18% (t −3.9)
Hedge variance cut, DCC vs regime model
24.7% vs 6.1%
  • Python
  • pandas
  • statsmodels
  • D3.js
Line chart of total connectedness in a 15-asset US macro network from 2004 to 2026, daily and rolling 500-day estimates, with bear markets shaded in grey.

Contagion Lab is a research platform for how financial shocks spread across US stocks, sectors, banks, Treasury yields, credit, currencies, commodities and volatility indices. It asks six questions a risk manager would ask, and writes each answer from the computed numbers rather than from a verdict decided in advance.

How it works #

  • Data. 93 daily series from Yahoo Finance, FRED, Cboe and the Federal Reserve, aligned on NYSE trading days. The main cross-asset network has 15 series from April 2003, and the data run to November 2026.
  • Timing as data. Every series carries its closing time. Tokyo closes before New York opens and some prices are stale, so part of what looks like a shock spreading over several days is a series taking in the previous day’s US news late. That lag is measured for each series.
  • Clean inputs. Yahoo’s daily currency bars changed convention around 2011, so FX comes from the Fed’s noon rates; oil and gold futures are spliced into ETF prices to remove roll jumps and the negative oil print of April 2020.
  • Models. Correlation and partial-correlation networks, dynamic factors, Granger and VAR networks, Diebold-Yilmaz connectedness (the share of each asset’s forecast-error variance that comes from the others), tail dependence and CoVaR, copulas, hidden Markov regimes, change-point detection and DCC-GARCH.
  • Claim levels. Every result is labelled descriptive (co-movement only), predictive (lead-lag content, tested out of sample) or identified (causal under stated assumptions), and the report keeps them apart. Every out-of-sample routine sees data up to the previous day only.

What I found #

Question Answer
Does connectedness rise before crises? Not reliably: no consistent build-up before 7 bear-market peaks (placebo p 0.47; smallest corrected q 0.36). It rises during crises and adds nothing out of sample beyond VIX and realised volatility
Which assets transmit shocks? Equities in the standard sense, but about 90% of that is same-day co-movement. Lagged spillovers are 1–3% of connectedness and line up with series that react late
Which sectors are most rate-sensitive? Real estate, homebuilders and utilities on descriptive betas. FOMC days identify the S&P 500’s response, −0.98% per 10bp policy-driven rise in the 2-year yield, but only 3 of 18 sector responses precisely
Do dynamic networks improve stress tests? Yes. An exponentially weighted (EWMA) covariance cuts stress-day prediction error by 18% against a static network (t −3.9). Yet every model’s 90% intervals cover only 62–80% of stress-day moves
Are tail correlations more informative? Tail dependence is real, but correlations measured on past tail days forecast future ones no better than the full history
Does regime detection improve hedging? No. Hedging with Treasuries, gold and the dollar, an adaptive (DCC) hedge cuts S&P 500 variance by 24.7%; hedges built on a hidden Markov regime model cut it by about 6%, no better than a static hedge

The models that win the stress tests all weight recent data heavily, while covariances conditioned on past crises do worse. Crises differ: the stock-bond correlation had opposite signs in 2008–2020 and in 2022.

Bar charts of S&P 500 variance reduction by hedging method, with Treasuries, gold and the dollar as hedges and with Treasuries only; DCC and EWMA hedges lead and the regime-model hedges come last
Bar charts of S&P 500 variance reduction by hedging method, with Treasuries, gold and the dollar as hedges and with Treasuries only; DCC and EWMA hedges lead and the regime-model hedges come last

The regime model’s value is episodic. In the 2020 crash its hedge lost 22.7% against 33.4% unhedged. In the 2022 rate shock it stayed long Treasuries while stocks and bonds fell together, and lost 40.1% against 24.1% unhedged. That fits a high-volatility state learned from flight-to-quality crises: the model can tell that markets are stressed, but a hedge needs the current correlation, not that of past crises.

Limits #

  • Seven crisis onsets is a small sample, so a modest pre-crisis effect could be missed.
  • Long credit history relies on Moody’s Baa spread, which updates a day late relative to equities, because the free ICE BofA spreads go back only three years.
  • No model is well calibrated: every stress-test interval here is too narrow for real stress days.

How it’s built #

A Python package with a data pipeline, network and regime libraries, a stress-testing engine with seven covariance views, and portfolio-risk tools (value at risk, expected shortfall, Euler risk decomposition). 33 estimator tests run on simulated data. A report and a six-view D3 dashboard are generated from the same outputs. The public repository holds the code, figures, tables and report, but no market data.