Understanding the CUSUM and EWMA control chart calculator — concept and principle
The exponentially weighted moving average (EWMA) chart and the cumulative sum (CUSUM) chart are statistical process control tools that catch small, sustained shifts in a process mean that an ordinary Shewhart chart is slow to notice. This calculator runs both through your data and checks for a signal.
How it is calculated
- EWMA statistic: zᵢ = λxᵢ + (1 − λ)zᵢ₋₁, starting from z₀ = μ₀ (the target mean).
- Asymptotic control limits: μ₀ ± L σ √(λ / (2 − λ)).
- Signal: out of control if |z_last − μ₀| exceeds L σ √(λ / (2 − λ)).
- Tabular CUSUM: C⁺ᵢ = max(0, xᵢ − (μ₀ + k) + C⁺ᵢ₋₁) and C⁻ᵢ = max(0, (μ₀ − k) − xᵢ + C⁻ᵢ₋₁), with k = 0.5σ; a signal is given when either sum passes h = 5σ.
λ (between 0 and 1) sets how much weight the newest observation gets, σ is the known process standard deviation for individual observations, and L sets the width of the limits in standard-deviation units.
The principle
Expanding the recursion shows that zᵢ is a weighted average of all past data, with weights λ, λ(1 − λ), λ(1 − λ)², … that shrink geometrically. Old observations fade but never vanish, so a small persistent shift accumulates in z while random noise averages out. The variance of zᵢ is σ² (λ/(2 − λ)) [1 − (1 − λ)²ⁱ], which settles at σ² λ/(2 − λ) after a few samples; that is where the limit width comes from.
Worked example
- Inputs: x = 10.1, 10.0, 10.2, 10.3, 10.4, 10.5; μ₀ = 10; σ = 0.2; λ = 0.2; L = 3.
- z₁ = 0.2 × 10.1 + 0.8 × 10 = 10.02; z₂ = 10.016; z₃ = 10.0528; z₄ = 10.10224; z₅ = 10.161792.
- z₆ = 0.2 × 10.5 + 0.8 × 10.161792 = 10.2294336.
- Limit half-width: 3 × 0.2 × √(0.2 / 1.8) = 0.2, so limits are 9.8 – 10.2.
- 10.2294 is above 10.2, so the chart says out of control.
- CUSUM with k = 0.1 and h = 1.0: C⁺ = 0, 0, 0.1, 0.3, 0.6, 1 and C⁻ stays 0; C⁺ reaches h at the sixth point, so the result is signal at obs. 6.
No single observation is more than 2.5σ from target, yet both charts detect the steady upward drift at the sixth point.
| Target mean | Last EWMA |
|---|---|
| 2.5 | 8.2633536 |
| 5 | 8.9187136 |
| 7.5 | 9.5740736 |
| 10 | 10.2294336 |
| 12.5 | 10.8847936 |
| 15 | 11.5401536 |
| 20 | 12.8508736 |
How to read the result
"In control" means the latest EWMA lies within the limits, not that the process is on target. After a signal, look for a cause that began a few samples earlier, since the EWMA lags. Common choices are λ = 0.05 to 0.25 with L near 3.
Common mistakes
- Estimating σ from data that already contain the shift, which widens the limits and hides the problem.
- Using a σ for subgroup means with individual values, or the reverse.
Frequently asked questions
How do I choose λ?
Use a smaller λ to detect smaller shifts. Published ARL tables, such as those of Lucas and Saccucci, help match λ and L to the shift size and false-alarm rate you want.
Sources: S. W. Roberts (1959), Control chart tests based on geometric moving averages, Technometrics 1(3) · J. M. Lucas and M. S. Saccucci (1990), Exponentially weighted moving average control schemes: properties and enhancements, Technometrics 32(1) · D. C. Montgomery, Introduction to Statistical Quality Control, Wiley