The Engineering Desk
Engineering, without the noise.

Lean Six SigmaSPC & Control Charts

Three questions pick the right control chart

Measurement or count, how many readings per point, and what you are counting. Worked X-bar and R and p chart examples show why a 3.5% day can be out of control while a 3.75% day is not.

A panel of brass pressure and vacuum gauges in a ship's boiler room
Photo: “HMS Belfast - Boiler room - Gauges 1” by Rémi Kaupp, CC BY-SA 3.0, via Wikimedia Commons

A control chart can only answer the question it was built to answer. Put individual readings on a chart designed for subgroup averages, or put a defect count on a chart designed for a fraction defective, and the limits will be wrong. Sometimes they are too tight, so the chart cries wolf every shift and people learn to ignore it. Sometimes they are too wide, so a real shift in the process slides by without a single point out of control. Neither failure is obvious from looking at the chart, because a wrong chart looks exactly like a right one.

The good news is that choosing the chart is not a matter of taste. Three questions settle it for almost every case on a factory floor: what kind of data you have, how it is collected, and what one plotted point is supposed to represent. This article walks through those questions, the seven charts most plants actually use, the constants behind their limits, and a full worked example for one variables chart and one attributes chart. It ends with the mistakes that turn a good chart into decoration and a short list of steps for setting one up.

First question: measurement or count?

Every control chart belongs to one of two families, and the split comes from the data, not from the process.

  • Variables data is a measurement on a continuous scale: a diameter in millimeters, a fill weight in grams, a torque in newton meters, a cure temperature, a cycle time. Two readings can differ by any amount, limited only by the resolution of the gage.
  • Attributes data is a count. Either you count units that fail (a board is good or defective), or you count defects on a unit (a painted panel has three runs and a scratch). The numbers are whole numbers, and the statistics behind them come from the binomial and Poisson distributions instead of the normal distribution.

When you have a choice, take the measurement. A diameter of 12.019 mm tells you the part is close to the upper limit and drifting; a go/no-go gage only tells you it still passes. Variables charts detect shifts with far smaller samples, often five parts where an attributes chart needs hundreds. Attributes charts earn their place when the characteristic truly is pass or fail (a missing component, a cosmetic flaw, a leak test with a yes or no result), or when you want one chart to summarize many kinds of failure at once.

Second question: how many readings form one point?

For variables data, the next question is the subgroup size, written nn: how many readings are taken together and summarized as one point on the chart.

Individuals and moving range (I-MR), n = 1

Use the I-MR chart when each reading stands alone. That is the normal case for batch processes (one viscosity reading per batch), slow processes (one part an hour), destructive tests, and computed values such as a daily scrap rate or a monthly yield. The individuals chart plots each reading. The moving range chart plots the absolute difference between each reading and the one before it, which is the only short term estimate of variation available when you have one value at a time.

X-bar and R, n from 2 to about 9

When you can take a few consecutive parts at a time, say five shafts off the lathe every hour, plot the subgroup average on an X-bar chart and the subgroup range (largest minus smallest) on an R chart. Averages are more sensitive than individual readings because averaging cuts the noise: the standard deviation of a mean of nn readings is σn\frac{\sigma}{\sqrt{n}}. Five is the classic size because it is easy to measure and calculate, and it catches a shift of about one and a half sigma quickly.

X-bar and S, n of 10 or more

The range throws away information. It uses only the two extreme readings in each subgroup, which is fine for four or five readings and increasingly wasteful as the subgroup grows. Once subgroups reach about 10 readings, replace the range with the subgroup standard deviation ss and use the X-bar and S chart. Many references draw the line at 9 or 10; some quality teams use S charts for any subgroup above 8. Whatever cutoff you choose, write it down and use it consistently. With software doing the arithmetic, there is no penalty for using S charts for smaller subgroups too.

Third question: what are you counting?

Attributes charts split along two lines: are you counting defective units or defects, and is the amount inspected the same every time?

  • p chart: the fraction of units that are defective, when the number inspected changes from sample to sample. A good unit and a defective unit are the only outcomes.
  • np chart: the number of defective units, when every sample is the same size. It carries the same information as a p chart, but operators find a count easier to read than a fraction.
  • c chart: the number of defects per inspection unit, when the inspection unit stays the same (one car door, one 100 meter roll, one board). One unit can have several defects.
  • u chart: defects per unit of opportunity, when the area, length or number of units inspected changes. Defects per square meter of painted panel, or defects per thousand solder joints, are typical.

The decision table

Put the three questions together and the choice becomes a lookup.

DataHow collectedPlotted statisticChartDistribution behind the limits
MeasurementOne reading at a timeEach reading, and the moving rangeI-MRNormal (approximately)
MeasurementSubgroups of 2 to about 9Subgroup mean and rangeX-bar and RNormal for means
MeasurementSubgroups of about 10 or moreSubgroup mean and standard deviationX-bar and SNormal for means
Defective unitsSample size variesFraction defectivepBinomial
Defective unitsSample size constantNumber defectivenpBinomial
DefectsSame inspection unit each timeDefects per samplecPoisson
DefectsInspection area or quantity variesDefects per unituPoisson

Rational subgrouping: the decision that matters most

The chart type follows from the data, but the subgroup is a choice you make, and it decides what the chart can see. The rule, from Walter Shewhart's original work, is that a subgroup should contain only the variation you consider normal and short term. Everything you want to detect should happen between subgroups.

That is why the classic subgroup is five consecutive parts from one machine, one cavity, one operator. Within those five parts, nothing much should change, so the range measures the common cause noise of the process. The X-bar chart then asks whether the hour-to-hour averages move more than that noise can explain.

Break the rule and the chart quietly fails. Suppose you take one part from each of four mold cavities and call it a subgroup of four. Real differences between cavities now live inside every subgroup, so the range is inflated, the limits on the X-bar chart are too wide, and the chart will hardly ever signal. The cure is to chart each cavity on its own, or to chart the cavity averages with an individuals chart. The same trap catches subgroups that span two spindles, two shifts, or parts pulled from a tote that mixed an hour of production.

The opposite mistake also happens. If the parts in a subgroup are so alike that the range is almost zero (for example, five readings of the same part), the limits become far too tight and nearly every point falls outside them. Repeat readings of one part measure the gage, not the process.

The constants, and what they stand for

Control limits are set at three standard deviations of the plotted statistic on either side of its center line. Most charts estimate that standard deviation from the average range or average standard deviation, using tabulated constants that depend on the subgroup size. They are not arbitrary fudge factors. Each one is a conversion from a range or a standard deviation to three standard errors of the statistic you plot.

The key constant is d2d_2, the expected range of nn readings from a normal distribution with a standard deviation of 1. It gives the estimate

σ^=Rˉd2.\hat{\sigma} = \frac{\bar{R}}{d_2}.

The X-bar chart limits are xˉˉ±3σ^n\bar{\bar{x}} \pm 3\frac{\hat{\sigma}}{\sqrt{n}}, and the constant A2A_2 simply packages that arithmetic:

A2=3d2n,UCLxˉ=xˉˉ+A2Rˉ,LCLxˉ=xˉˉ−A2Rˉ.A_2 = \frac{3}{d_2\sqrt{n}}, \qquad \text{UCL}_{\bar{x}} = \bar{\bar{x}} + A_2\bar{R}, \qquad \text{LCL}_{\bar{x}} = \bar{\bar{x}} - A_2\bar{R}.

The R chart limits are D3RˉD_3\bar{R} and D4RˉD_4\bar{R}. For an individuals chart, the moving range has n=2n = 2, so d2=1.128d_2 = 1.128 and

E2=31.128=2.66,limits=xˉ±2.66 MR‾,UCLMR=3.267 MR‾.E_2 = \frac{3}{1.128} = 2.66, \qquad \text{limits} = \bar{x} \pm 2.66\,\overline{MR}, \qquad \text{UCL}_{MR} = 3.267\,\overline{MR}.

nd2A2D3D4
21.1281.88003.267
31.6931.02302.574
42.0590.72902.282
52.3260.57702.114
62.5340.48302.004
72.7040.4190.0761.924

Standard control chart constants. D3 is zero for subgroups of six or fewer, so the R chart has no lower limit there.

Two points about the constants are worth remembering. First, use the constant for the subgroup size you actually have. A table lookup error, such as using A2A_2 for n=4n = 4 on subgroups of 5, changes the limits by about 26%. Second, the constants estimate short term variation from within subgroups. They do not use the overall standard deviation of all the data, and that difference is the whole point: limits built from the overall spread already include any shifts between subgroups, so they cannot detect them.

Worked example 1: an X-bar and R chart for a turned shaft

A lathe turns a shaft with a bearing diameter specified at 12.000 mm plus or minus 0.025 mm. Every hour, the operator measures five consecutive shafts. After 20 hours, the team has 20 subgroups of 5, or 100 readings. The subgroup averages and ranges summarize to

xˉˉ=12.004 mm,Rˉ=0.021 mm.\bar{\bar{x}} = 12.004 \text{ mm}, \qquad \bar{R} = 0.021 \text{ mm}.

Step 1: Limits for the R chart

Always start with the range chart. If the within-subgroup variation is not stable, the X-bar limits, which are built from Rˉ\bar{R}, mean nothing. For n=5n = 5, D3=0D_3 = 0 and D4=2.114D_4 = 2.114:

UCLR=2.114×0.021=0.0444 mm,LCLR=0.\text{UCL}_R = 2.114 \times 0.021 = 0.0444 \text{ mm}, \qquad \text{LCL}_R = 0.

The team checks the 20 ranges. None exceeds 0.0444 mm and there are no unusual runs, so the short term variation is stable.

Step 2: Limits for the X-bar chart

With A2=0.577A_2 = 0.577:

A2Rˉ=0.577×0.021=0.0121 mm,A_2\bar{R} = 0.577 \times 0.021 = 0.0121 \text{ mm},

UCLxˉ=12.004+0.0121=12.0161 mm,LCLxˉ=12.004−0.0121=11.9919 mm.\text{UCL}_{\bar{x}} = 12.004 + 0.0121 = 12.0161 \text{ mm}, \qquad \text{LCL}_{\bar{x}} = 12.004 - 0.0121 = 11.9919 \text{ mm}.

Step 3: Check the arithmetic against sigma

The process standard deviation estimate is

σ^=0.0212.326=0.00903 mm,\hat{\sigma} = \frac{0.021}{2.326} = 0.00903 \text{ mm},

and three standard errors of a mean of five is 3×0.009035=0.01213 \times \frac{0.00903}{\sqrt{5}} = 0.0121 mm, which matches A2RˉA_2\bar{R}. The constant was doing exactly that calculation.

Step 4: Read the chart, and do not confuse it with the drawing

Notice that the control limits (11.9919 to 12.0161 mm) are much narrower than the specification (11.975 to 12.025 mm). That is normal, because the limits describe averages of five parts, and averages vary less than individual parts. An individual shaft at 12.020 mm is inside the specification and says nothing alarming. A subgroup average of 12.018 mm is above the upper control limit and says the process has shifted, even though every part in that subgroup may still be good. That early warning, before scrap appears, is what the chart is for.

The data also answer a capability question. The process mean is 0.004 mm above nominal, and the upper specification is 12.025−12.004=0.02112.025 - 12.004 = 0.021 mm away, or about 0.0210.00903=2.3\frac{0.021}{0.00903} = 2.3 sigma. That gives a Cpk of about 0.78, so the process is stable but not capable. Centering it would help, but the variation is also too large to give a Cpk of 1.33. The control chart tells you the process is predictable; capability tells you whether the prediction is good enough. They are separate questions.

Worked example 2: a p chart with varying sample sizes

An electronics plant runs a final functional test on circuit boards. The number tested each day depends on the schedule, from 400 to 1,200 boards. Over 20 production days, the plant tested 15,600 boards and found 312 defective.

Step 1: The center line

The center line is the total defectives divided by the total inspected, not the average of the daily fractions:

pˉ=31215,600=0.020=2.0%.\bar{p} = \frac{312}{15{,}600} = 0.020 = 2.0\%.

Step 2: Limits that change with sample size

The standard deviation of a fraction from a sample of nn is pˉ(1−pˉ)n\sqrt{\frac{\bar{p}(1-\bar{p})}{n}}, so each day gets its own limits:

UCL=pˉ+3pˉ(1−pˉ)n,LCL=pˉ−3pˉ(1−pˉ)n.\text{UCL} = \bar{p} + 3\sqrt{\frac{\bar{p}(1-\bar{p})}{n}}, \qquad \text{LCL} = \bar{p} - 3\sqrt{\frac{\bar{p}(1-\bar{p})}{n}}.

Boards tested (n)Three sigmaUCLLCLExpected defectives
4000.02104.10%0 (none)8
8000.01483.48%0.52%16
1,2000.01213.21%0.79%24

Worked example with illustrative data. A negative lower limit is set to zero.

The limits step in and out as the daily volume changes, which looks odd the first time people see it, but it is correct. A small sample can swing a long way by chance; a big one cannot.

Step 3: Two days that look alike

On one day the plant tested 400 boards and found 15 defective, a rate of 3.75%. On another it tested 1,200 and found 42 defective, a rate of 3.5%. The first point is inside its upper limit of 4.10%. The second is above its limit of 3.21% and signals a special cause, even though its rate is lower. Forty-two defectives when 24 are expected is a much stronger signal than 15 when 8 are expected. Anyone who plotted the daily rates against a single fixed limit would have reached the wrong conclusion on both days.

If the daily sample size had been fixed at 500, an np chart would have been simpler: center line 500×0.02=10500 \times 0.02 = 10 defectives, upper limit 10+310×0.98=19.410 + 3\sqrt{10 \times 0.98} = 19.4, and lower limit 0.6. Operators would just compare the count to 19.

Step 4: Check for overdispersion

The p chart assumes every board has the same chance of failing, independent of every other board. With very large samples, that assumption is almost never quite true. Lots of components differ, solder paste ages through the day, and these small real shifts are larger than the binomial model allows. The result is limits that are too tight, with many points flagged out of control even though nothing special happened.

David Laney's p' chart (p prime) corrects for this. It converts each point to a z score, measures how much those z scores actually vary from point to point using a moving range, and multiplies the binomial limits by that ratio, called σz\sigma_z. If σz\sigma_z is near 1, the ordinary p chart was fine. If the plant's data gave σz=2.1\sigma_z = 2.1, the limit for a 1,200-board day would widen from 3.21% to

0.020+3×2.1×0.020×0.9801,200=4.55%,0.020 + 3 \times 2.1 \times \sqrt{\frac{0.020 \times 0.980}{1{,}200}} = 4.55\%,

and the 3.5% day would no longer count as a signal. Neither answer is automatically right. A large σz\sigma_z is itself a finding: it says day-to-day variation is real and worth studying, but it should not be treated as a stream of separate alarms. Laney's chart, or an individuals chart of the daily rates, is the honest choice when sample sizes run into the thousands.

Defect counts: c and u charts

For defects rather than defectives, the Poisson distribution sets the limits, and its variance equals its mean. A paint line that averages cˉ=5.2\bar{c} = 5.2 defects per car door has limits of 5.2±35.25.2 \pm 3\sqrt{5.2}, giving an upper limit of 12.0 defects and no lower limit (the calculation gives a negative number).

When the amount inspected changes, convert to a rate. If the line found 84 defects on 60 square meters of panels, uˉ=8460=1.4\bar{u} = \frac{84}{60} = 1.4 defects per square meter, and a sample of area aa has limits

uˉ±3uˉa.\bar{u} \pm 3\sqrt{\frac{\bar{u}}{a}}.

For a 4 square meter sample the upper limit is 3.17 defects per square meter; for 8 square meters it tightens to 2.65, with a lower limit of 0.15. As with the p chart, the limits follow the sample size. The same overdispersion caveat applies: defects that cluster (one bad spray gun leaving runs across a whole batch) violate the Poisson assumption and make the chart too sensitive. Laney's method has a u' version for that case.

Common mistakes

Charting measurements as pass or fail

Plants with a measured characteristic sometimes chart the fraction out of tolerance on a p chart because "that is what the customer cares about." The chart then reacts only after parts are already bad, and it needs hundreds of samples to see what five measurements would have shown. If you measure it, chart the measurement.

Using the wrong chart for individual readings

Treating a set of consecutive single readings as a subgroup (for example, grouping five batches into an artificial subgroup) mixes batch-to-batch variation into the range and inflates the limits. Batch data belongs on an I-MR chart.

Drawing specification limits on the chart

Specification limits come from the drawing and describe what the customer will accept. Control limits come from the process and describe what it will do. Putting tolerance lines on an X-bar chart is especially misleading, because averages are plotted against limits meant for individual parts, and the averages will almost never get near them. Keep specifications on histograms and capability reports.

Recalculating limits all the time

Some systems recompute the limits every time a new point arrives. A slow drift then pulls the limits along with it, and the chart never signals. Set limits from a stable baseline of at least 20 to 25 subgroups, freeze them, and recompute only after a documented change to the process: new tooling, a new material supplier, a deliberate improvement.

Using the overall standard deviation

Calculating limits as the grand mean plus or minus three times the standard deviation of all the readings feels natural, but it builds every shift in the data into the limits. Use Rˉ\bar{R}, sˉ\bar{s} or MR‾\overline{MR} with the right constants.

Ignoring the gage

If the measurement system cannot resolve the variation, a variables chart shows chunky data with only a few distinct values, and the range chart often shows many zero ranges. Fix the gage first; a control chart cannot be better than the measurements behind it.

Setting up a chart in practice

  1. Name the question. Write down which characteristic matters and what kind of change you want to catch: a shift in average, more spread, more defects.
  2. Classify the data. Measurement or count; if a count, defectives or defects.
  3. Choose the subgroup. Decide how many readings, how often, and from which stream (one machine, one cavity, one line), so that each subgroup holds only short term variation.
  4. Pick the chart from the table. Use the subgroup size and sample size rules above.
  5. Collect a baseline. Gather at least 20 to 25 subgroups, or 100 or more individual readings, without adjusting the process for the sake of the chart.
  6. Compute and check the dispersion chart first. R, S or MR must be stable before the limits on the average chart can be trusted. For attributes charts with large samples, check for overdispersion.
  7. Freeze the limits and react to signals. Apply your out-of-control rules consistently, record the cause of each signal, and recompute only when the process truly changes.

Choosing the chart takes a few minutes once the three questions are answered. Choosing the subgroup takes thought, and it is the part worth arguing about with the people who run the process. A correct chart with a sensible subgroup will show you when the process changes and, just as important, when it has not, so nobody wastes a shift chasing noise.

More in SPC & Control Charts