Quant Memo
Core

Changepoint Detection and CUSUM

Methods for detecting the exact moment a time series' underlying behavior shifted — a new mean, a new volatility regime — using cumulative sums of deviations that build up a detectable signal once a real, persistent change occurs.

Prerequisites: Threshold and Smooth Transition Models

A strategy's daily P&L has averaged roughly flat with some noise for months, but you suspect something changed three weeks ago — maybe a market-structure shift quietly eroded the edge. Looking at a rolling average can hint at this, but rolling averages lag and smear out exactly when a real shift happened, and they react to every wiggle, not just genuine, persistent changes. Changepoint detection methods are built specifically to answer "did something real change, and if so, exactly when" — separating a true, lasting shift in behavior from ordinary short-term noise, using the fact that a genuine break leaves an accumulating, one-directional footprint in the data that noise alone does not.

An analogy: a tally that only grows when something's off

Imagine tracking a machine's output by writing down, each hour, how far that hour's production deviated from the expected target, and keeping a running total of these deviations rather than looking at each hour in isolation. If the machine is working normally, positive and negative deviations roughly cancel out over time, so the running total wanders near zero, going up a bit, down a bit. But if the machine's calibration genuinely slips — say, it starts running consistently low — every hour's deviation now points the same direction, and the running total starts climbing (or falling) steadily rather than wandering. The CUSUM (cumulative sum) method is exactly this running tally: it's built to stay near zero under normal noise, but to build up a clear, accelerating signal exactly once a persistent shift begins.

The mechanics, one symbol at a time

The CUSUM statistic accumulates deviations of the series yty_t from a reference value μ0\mu_0 (the target or historical mean), typically with a small allowance kk for normal drift:

St=max(0,  St1+(ytμ0)k),S_t = \max\big(0,\; S_{t-1} + (y_t - \mu_0) - k\big),

where StS_t is the running cumulative sum at time tt (reset to 0 whenever it would go negative, so it only tracks sustained upward deviation — a mirror-image version tracks downward shifts), ytμ0y_t - \mu_0 is this period's raw deviation from target, and kk is a small slack term subtracted each period so ordinary noise doesn't slowly accumulate into a false alarm. In plain English: each period, add this period's deviation (minus a small allowance) to the running total, but never let the total go below zero — under normal conditions, deviations that are sometimes positive and sometimes negative keep StS_t hovering near zero, but once the series shifts to a persistently higher level, every period adds a positive amount and StS_t climbs steadily. A changepoint alarm triggers when StS_t crosses a pre-chosen threshold hh, and the changepoint's estimated location is typically identified as where the climb actually began, not where the alarm fired.

Worked example 1: CUSUM catching a mean shift

Suppose a strategy's daily P&L target is μ0=0\mu_0 = 0 with allowance k=0.1k=0.1, and actual daily P&Ls for 6 days are {0.2,0.1,0.3,0.9,1.1,0.8}\{0.2, -0.1, 0.3, 0.9, 1.1, 0.8\} (a shift up starting around day 4). Computing StS_t step by step: S1=max(0,0+0.20.1)=0.1S_1 = \max(0, 0+0.2-0.1)=0.1; S2=max(0,0.10.10.1)=max(0,0.1)=0S_2=\max(0, 0.1-0.1-0.1)=\max(0,-0.1)=0; S3=max(0,0+0.30.1)=0.2S_3=\max(0,0+0.3-0.1)=0.2; S4=max(0,0.2+0.90.1)=1.0S_4=\max(0,0.2+0.9-0.1)=1.0; S5=max(0,1.0+1.10.1)=2.0S_5=\max(0,1.0+1.1-0.1)=2.0; S6=max(0,2.0+0.80.1)=2.7S_6=\max(0,2.0+0.8-0.1)=2.7. The statistic sat near zero for the first three days (normal noise canceling out) and then climbed steadily from day 4 onward — if the alarm threshold were set at h=1.5h=1.5, the alarm would trigger on day 5 (S5=2.0>1.5S_5=2.0 > 1.5), correctly flagging that a persistent upward shift began around day 4.

Worked example 2: choosing the threshold trade-off

Suppose two thresholds are considered: h=1.0h=1.0 and h=2.5h=2.5, applied to the same P&L sequence. With h=1.0h=1.0, the alarm would have triggered already on day 4 (S4=1.0S_4=1.0) — fast detection, but more prone to false alarms on noisy days that happen to run a short positive streak. With h=2.5h=2.5, the alarm doesn't trigger until day 6 (S6=2.7S_6=2.7) — slower to react, but far less likely to be fooled by ordinary noise. This is CUSUM's fundamental trade-off: a lower threshold catches real changes faster (and false alarms more often); a higher threshold catches real changes slower (but false alarms less often) — the choice of hh should reflect how costly a missed change is versus how costly a false alarm is in the specific application.

threshold h true change begins
The CUSUM statistic wanders near zero under normal noise (days 1-3), then climbs steadily once the persistent shift begins around day 4 — the alarm fires once it crosses the threshold, a few days after the true change actually started.
h=1.0 (fast, noisier) h=2.5 (slow, safer)
A lower threshold (amber) triggers the alarm sooner but risks more false positives; a higher threshold (red) waits for stronger evidence before sounding — the same underlying CUSUM path, two different detection speeds.

What this means in practice

CUSUM and related changepoint methods are used to monitor live strategy P&L, model residuals, or risk factor exposures for genuine regime breaks, distinguishing a real degradation in edge from ordinary streaky noise — critical for deciding when to actually pull a strategy rather than reacting to every rough week. It complements smoother trend-extraction tools like the Hodrick-Prescott filter (see The Hodrick-Prescott Filter), which characterizes gradual trend versus cycle but isn't designed to pinpoint discrete break moments the way CUSUM is.

CUSUM accumulates a series' deviations from a target into a running total that hovers near zero under ordinary noise but climbs steadily once a persistent shift begins, letting an alarm threshold separate genuine, lasting regime changes from short-term fluctuation — with the threshold choice trading off detection speed against false-alarm rate.

A common mistake is treating the moment the CUSUM alarm fires as the moment the change actually happened — by construction, the alarm only fires after enough cumulative evidence has built up, meaning the true changepoint typically occurred somewhat earlier than the detection date. When precise dating of a break matters (for instance, isolating exactly which period's data is now unreliable), estimate the changepoint location separately by finding where the cumulative sum's climb actually began, not the later date the alarm crossed threshold.

Related concepts

Practice in interviews

Further reading

  • Page, Continuous Inspection Schemes, Biometrika
  • Basseville and Nikiforov, Detection of Abrupt Changes: Theory and Application, ch. 2
ShareTwitterLinkedIn