Skip to content
You Start with one site
Amounts in Start with one site
Data & Statistics · Concept

CUSUM

One idea Intermediate 5 min read
Found this useful?

A bank balance that loses a little every day shows nothing alarming on any single day, yet after a month the fall is plain. The CUSUM (cumulative sum) does this with readings: it adds up how far each reading sits above normal, so a small lasting shift shows within days, even when no single reading looks wrong.

Look at each dayNo single day is far from normal.Misses it
Wait for a bill600 L a day for a month is 18,000 L.Too late
Add the differencesSmall and lasting becomes large.This is the CUSUM

See it

Predict first

The night flow of a borehole is normally about 600 L/h and varies by about 20 L/h from night to night. A control chart has its limit at about 662 L/h. A leak of 25 L/h starts on day 21. When does the control chart signal?

See it: forty nights of flow, a leak from day 21

Control chart signal
CUSUM signal
Estimated start, size

The reference mean and standard deviation come from days 1 to 20, before the leak. The CUSUM uses k = half a standard deviation and signals when it passes h = five standard deviations.

The idea

Take a reference mean μ0 and standard deviation σ from a period you believe was normal. For each new reading, take how far it is above μ0, subtract a small allowance k, and add the result to a running total that never goes below zero:

Ct = max(0, Ct−1 + xt − μ0 − k)

xt today's reading, Ct−1 yesterday's total, k usually 0.5 σ. A signal is given when Ct passes h, usually 5 σ

On normal days the allowance pulls the total back to zero. After a lasting shift, each day adds a little and the total climbs. A control chart judges each reading alone, so it needs a large shift; the CUSUM remembers, so it finds a small one.

It also dates the change: the shift began the day after the total was last zero. The size is about k + C ÷ N, where N is the number of days the total has been above zero.

One worked number

The question

A night flow has μ0 = 600 L/h and σ = 20 L/h, so k = 10 and h = 100. Five nights read 630, 625, 640, 630 and 635 L/h. Does the CUSUM signal, and how large is the shift?

Show the worked solution, 3 steps
  1. Take each reading less μ0 and k

    630 − 610 = 20, then 15, 30, 20, 25.

  2. Add them up

    C = 20, 35, 65, 85, 110. It passes h = 100 on the fifth night. It was zero before the first, so the shift began on night 1. No reading passed the control limit of 600 + 3 × 20 = 660 L/h.

  3. Estimate the size

    10 + 110 ÷ 5 = 32 L/h. In the figure, a leak of 25 L/h gives a similar result: signal on day 25, start day 21.

The mistake to avoid

No point beyond the limits does not mean nothing changed. A shift of one standard deviation can stay inside the limits for weeks. A leak of 25 L/h is 600 L a day, 18,000 L a month, all pumped and paid for.

A second trap: a reference period that includes the change. The shift raises the reference and hides. Press the button in the figure: with the reference from all 40 days, the CUSUM never signals.

Check yourself

Question 1

A process has μ0 = 50 and σ = 2, so k = 1 and h = 10. The readings are 51, 49, 52, 53, 54, 53, 55. At which reading does the CUSUM signal?

Question 2

To save time, an analyst takes μ0 and σ from the whole year of night flow, including the months since a suspected leak. What happens?

Question 3

A night flow CUSUM signals on day 40. Its total was last zero on day 34. On which day did the leak most likely begin?

Where you meet it

  • A borehole and its pipesThe night flow rises when a pipe leaks, and the CUSUM dates the first night of the loss.
  • A building's energyA CUSUM of the gap between the meter and its baseline shows the day a saving began, or the day it was lost.
  • A pump that wears slowlyThe CUSUM shows that the mean has moved, but a slow drift has no single start day, so the date means little.
Key points
  • The CUSUM adds up small deviations from a fixed reference, so a small lasting shift shows.
  • Ct = max(0, Ct−1 + xt − μ0 − k), with k = 0.5 σ and a signal at h = 5 σ.
  • The shift began the day after the total was last zero.
  • The reference must come from a period before the change.
Found this useful?

Discussion

    Comments show your name. Be kind, stay on the topic.