Moving average chart: detect small shifts in individual data

Updated

A moving average chart plots, at each point in time, the average of the most recent w observations, called the span. Averaging smooths out point-to-point noise, so the chart's limits are tighter than those of an individuals chart and it detects small, sustained shifts in the mean sooner. Each plotted point shares w − 1 values with the one before it, which is why the chart reads differently from a Shewhart chart.

When to use it

  • You measure one value at a time (one result per batch, per hour or per day), and the shifts that matter are small, around 1 to 1.5σ.
  • The process changes in steps or slow drifts rather than in sudden single-point upsets.
  • You want something easier to explain than a CUSUM: "the average of the last four batches" needs no theory.

For large, sudden upsets, the individuals chart reacts faster. For small shifts, the EWMA chart and the CUSUM chart are usually more efficient, because they weight the data more smoothly; the moving average chart is the simplest of the three time-weighted charts.

How it works

Pick a span w (3 to 5 is common). For observation i:

Mᵢ = (xᵢ + xᵢ₋₁ + … + xᵢ₋w₊₁) / w for i ≥ w Mᵢ = (x₁ + … + xᵢ) / i for i < w

The center line is the process mean μ₀ (a target, or the mean from a stable baseline). An average of k independent values has standard deviation σ/√k, so the limits are

UCLᵢ = μ₀ + 3σ / √min(i, w) LCLᵢ = μ₀ − 3σ / √min(i, w)

The first w − 1 points average fewer values and get wider limits. σ is the short-term standard deviation of the individual values, usually MR̄/1.128 from an I-MR chart of a stable period.

Use only Test 1 (a point beyond the limits). Consecutive moving averages share most of their data, so they are strongly correlated, and runs or zone patterns appear by construction. The tests for special causes based on runs do not apply.

Example

A dairy standardizes milk to 3.00% fat for a customer contract. Each silo batch is tested once. Last month's I-MR chart of a stable period gave μ₀ = 3.000% and σ = MR̄/1.128 = 0.030%. The plant charts a moving average with span w = 4. The fat results for 20 batches (%):

Batches 1–56–1011–1516–20
2.998, 2.970, 3.027, 2.987, 3.0422.956, 3.014, 2.999, 3.022, 2.9753.008, 3.046, 2.966, 2.987, 3.0313.018, 3.081, 3.020, 3.025, 3.065
  • Batch 1: M₁ = 2.998, limits 3.000 ± 3 × 0.030 / √1 = 2.910 to 3.090.
  • Batch 2: M₂ = (2.998 + 2.970)/2 = 2.984, limits 3.000 ± 0.0636.
  • Batch 3: M₃ = 2.9983, limits 3.000 ± 0.052.
  • From batch 4 on: limits 3.000 ± 3 × 0.030 / 2 = 2.955 to 3.045.
  • Batch 20: M₂₀ = (3.081 + 3.020 + 3.025 + 3.065)/4 = 3.0478.
Moving average chart of milk fat, span 42.902.953.003.053.10Moving average of fat (%)CL=3UCL=3.045LCL=2.955135791113151719Batch
Moving average chart of milk fat, span 4

The moving average crosses the upper limit at batch 20. For comparison, here are the same values on an individuals chart with limits 3.000 ± 0.090:

Individuals chart of milk fat2.902.953.003.053.10Fat (%)CL=3UCL=3.09LCL=2.91135791113151719Batch
Individuals chart of milk fat

No single batch is beyond the individuals limits, and none of the eight tests has fired by batch 20. Yet batches 16 to 20 average 3.042%, about 1.4σ above target. The standardizer's density sensor had been recalibrated after batch 15 with a wrong reference value, so the line was leaving extra cream in the milk. The sensor was recalibrated again.

How to read the results

  • A point beyond the limits means the recent average has moved: a shift of the mean that started up to w points earlier. Look back over the last w observations for the start.
  • Do not read runs. Several consecutive points on one side are expected even with no change, because each point reuses the previous data.
  • The signal lags a sudden change by up to w points, and a single spike is diluted by w. Keep the raw values in view.
  • Larger spans detect smaller shifts but react more slowly and smear the timing of a change.

Common mistakes

  • Using the individuals limits on the moving averages. The averages need limits divided by √w; with the ±3σ individuals limits, the chart almost never signals.
  • Forgetting the wider limits at the start. The first w − 1 points average fewer values; giving them the full-span limits causes false alarms.
  • Estimating σ from the moving averages. σ must come from the individual values, through MR̄/1.128 or a stable baseline.
  • Restarting the averages after every adjustment without saying so. If you reset the average after a process change, mark it on the chart so readers know which points share data.

Frequently asked questions

How do I choose the span w?

Larger spans detect smaller shifts. A rough guide is that a span of w makes the chart about as sensitive to a shift of 3σ/√w as an individuals chart is to a 3σ shift. Spans of 3 to 5 are common; above about 8, an EWMA chart is usually a better choice.

What is the difference between a moving average chart and an EWMA chart?

The moving average gives equal weight to the last w values and none to older ones. The EWMA chart gives every past value a weight that shrinks gradually with age. EWMA responds more smoothly and usually detects small shifts with fewer false alarms.

Can I use a moving average chart for subgroup means?

Yes. Replace σ with the standard error of the subgroup means, σ/√n, and average the last w subgroup means. The rest is the same.

Why are the first limits wider?

Because the first points average fewer than w values. An average of one value has the full σ; an average of two has σ/√2, and so on until the span is full.

Try it with your own data

StatLab SPC is free, open-source statistics for engineers. It runs in your browser, works offline, and never uploads your data.

Open StatLab