Research note
Historical correlations on /rotation
Matrix heatmaps, rolling charts, and the structural-vs-tactical framework: how to read what two tickers do together, and when a relationship breaks.
The Correlations tab on /rotation shows two complementary views of how sectors / themes move together:
- Matrix heatmap — pairwise correlation of daily log returns over a rolling window. Cells coloured green-to-red on the level view, or indigo-to-amber on the shift view (latest window correlation − same window 30 days ago).
- Rolling correlation chart — pick any two tickers, see how their correlation has evolved. Reference lines at ±1, ±0.5, 0.
Time horizons: 20d → 10Y
Both views support multiple windows. They're not redundant — each one tells you a different story:
| Window | What it shows | Best for |
|---|---|---|
| 20d / 60d / 120d | Tactical — recent regime | Short-term pair trading, risk-on / risk-off reads |
| 1Y | Cyclical — current cycle | Where the relationship sits in the present economic regime |
| 3Y | Multi-cycle — last full economic phase | Smooths cycle noise, exposes regime shifts |
| 5Y | Strategic — long-run trend | Confirms structural relationships |
| 10Y | Structural — pre-COVID baseline | Anchor: what the "normal" correlation has been |
The matrix supports all windows up to 10Y. The rolling chart caps at 5Y because a 10Y rolling correlation is so smoothed it's effectively a single number — no trajectory to plot.
The structural-vs-tactical framework
Long windows tell you what's structural — the baseline relationship that has held across cycles. Short windows tell you what's tactical — where the relationship sits today. The interesting trade isn't the level of either one; it's the gap between them.
Worked example — XLK / TLT over three windows on the same day:
| Window | Mean | Latest | Read |
|---|---|---|---|
| 5Y rolling | −0.19 | +0.05 | Decade-long inverse relationship is decaying |
| 1Y rolling | +0.07 | +0.08 | Cyclical regime: now slightly positive |
| 60d rolling | +0.02 | +0.42 | Tactical break is sharply accelerating |
Three windows, three different stories of the same pair. The 5Y mean (−0.19) tells you what the relationship used to be — textbook "rates-up = tech-down." The 1Y mean (+0.07) tells you that's already broken at the cycle level. The 60d latest (+0.42) tells you the break is now sharply accelerating. Without the long windows you can't tell whether the +0.42 today is normal or a regime change — they give you the anchor against which the tactical reading is evaluated.
When the matrix views diverge
On the matrix view, each pair has a 10Y structural number and a 60d-by-default tactical number. When they agree (XLK / XLY at +0.83 over 10Y, ~+0.7 today) the relationship is stable. When they disagree by 0.4+ points, treat that pair as a regime change candidate — drill into it on the rolling chart at progressively shorter windows to see when the break started.
Why shifts matter more than levels
Two sectors being correlated +0.8 isn't inherently informative — if they've been +0.8 for years (e.g. XLK vs XLY), that's just structure. What's informative is when a long-stable relationship breaks. The shift column on the matrix surfaces the recent break for every pair at once; the rolling chart shows the full trajectory of any single pair.
Pre-set pairs worth watching
- XLK / TLT — tech vs long bonds. 5Y mean historically inverse; recent regime has flipped to positive. Worked example above.
- XLE / TLT — commodity inflation vs duration; typically inverse. Decoupling = inflation regime resolving.
- XLY / XLP — cyclicals vs defensives. Deep negative = clear risk-on/off split; decoupling = transition.
- IWM / SPY — small caps vs large caps. Persistent decoupling marks narrow-leadership / breadth-deterioration, the standard late-cycle pattern.
- XLF / XLRE — banks vs REITs. Both rate-sensitive but in opposite directions on the curve. Decoupling = curve regime change.
- GLD / DXY — textbook inverse. When gold rallies with a strong dollar, something macro-structural has shifted.
Math
Both views use Pearson correlation on daily log returns (more numerically stable than simple returns around extreme moves). The window length is in trading days (1Y = 252, 5Y = 1260, 10Y = 2520) but the underlying fetch is in calendar days, so the engine pulls ~1.6× the trading-day window to make sure the correlation has full samples.
On the themes universe, ETFs launched within the last few years (e.g. some clean-energy or AI funds from 2020+) will have shorter histories than the requested 10Y window. Pandas handles this with pairwise complete observations — the cell value reflects whatever overlap each pair actually has, so you'll see lower-confidence numbers for newer themes rather than NaN.
This article is also a chapter of the Education page.