Hospitals stream thousands of vital-sign readings per patient per shift. A single elevated heart-rate reading is normal noise; a slow, sustained drift above baseline is an early physiological signature of conditions like sepsis, and it can start hours before any one reading crosses a classic fixed alarm threshold.
A CUSUM (cumulative sum) control chart accumulates small persistent deviations instead of judging each reading alone:
S⁺(n) = max(0, S⁺(n-1) + (x(n) − μ0 − k))
alarm when S⁺(n) > h
x(n) = heart-rate reading at sample n
μ0 = baseline (resting) heart rate
k = slack — the per-sample drift you tolerate as noise
h = decision threshold — how much accumulated evidence triggers an alert
- Drift rate — how fast the simulated patient's true heart rate climbs once deterioration starts (bpm per simulated minute).
- Slack k — raise it to ignore small fluctuations (fewer false alarms, slower detection); lower it to catch smaller drifts sooner.
- Threshold h — how much accumulated evidence is required before CUSUM fires. Lower h reacts faster but tolerates more noise-driven false positives.
- Fixed-threshold alarm — the conventional "beep when HR > X bpm" monitor, shown for comparison. It only fires once a single reading actually crosses the line.
- Run 500 trials — simulates 500 independent patient streams offline at the current k/h/drift/threshold settings and reports the average detection lead time and the false-alarm rate for both detectors on runs with no deterioration at all.
Click Trigger Deterioration and watch the cyan CUSUM trace climb and cross its threshold well before the red fixed-threshold line does — the gap between the two alarm times is the early-warning lead time a streaming statistical model buys the clinical team. Click Run 500 trials for a statistically robust estimate of that lead time and of each detector's real false-alarm rate.