Sub topic 5
Estimating sigma from subgroups
Every capability index in this tutorial divides by a standard deviation, so the index is only as good as that number. This chapter covers how to estimate the within-subgroup sigma from rational subgroups, why the usual shortcut is R-bar/d2 and not the plain standard deviation of all the data, and where the estimate goes wrong. It assumes you know the sample standard deviation and have seen an Xbar-R control chart.
Why the choice of sigma matters
Two standard deviations can be computed from the same measurements, and they answer different questions.
- Overall sigma is the ordinary sample standard deviation of every measurement. It includes all variation: random scatter within a short run, plus any drift or shifts between runs.
- Within-subgroup sigma measures only the short-term scatter inside small groups of measurements taken close together in time. Shifts between groups do not enter it.
Cp and Cpk are defined with the within-subgroup sigma. They describe what the process can do when it runs in a stable state. The overall sigma belongs to Pp and Ppk, which a later chapter covers. If you put the overall sigma into Cp and Cpk, you quietly compute Pp and Ppk and report them under the wrong name.
Rational subgroups
A rational subgroup is a small set of consecutive measurements taken under conditions that are as similar as possible. Typical examples are five parts from one machine in one minute, or three samples from one batch. The aim is that variation inside a subgroup contains only common-cause scatter. Any shift between operators, tools, material lots, or shifts then appears between subgroups.
Good subgroup design follows a few rules:
- Take the parts in production order, from one source, in a short time window.
- Keep the subgroup size constant. The d2 table assumes one size at a time.
- Use sizes of about 3 to 5 for most work. Larger groups are more likely to straddle a change.
- Collect at least 20 to 25 subgroups before trusting the estimate. Fewer gives a noisy sigma.
The R-bar/d2 estimator
For each subgroup, compute the range R, which is the maximum minus the minimum. Average the ranges to get R-bar. The within sigma is then:
sigma_within = R-bar / d2
The constant d2 depends only on the subgroup size n. It is the average range you expect from a sample of n values from a normal distribution with standard deviation 1. If d2 for n = 5 is 2.326, then five normal values spread across about 2.326 standard deviations on average. Dividing the observed average range by d2 converts it back to a standard deviation.
| Subgroup size n | d2 | c4 |
|---|---|---|
| 2 | 1.128 | 0.7979 |
| 3 | 1.693 | 0.8862 |
| 4 | 2.059 | 0.9213 |
| 5 | 2.326 | 0.9400 |
| 6 | 2.534 | 0.9515 |
| 10 | 3.078 | 0.9727 |
The c4 column is used by the s-bar method described later in this chapter.
The range method works well because a range is simple and, for small n, almost as efficient as the standard deviation. For n above about 8 to 10, the range ignores the middle values and loses efficiency, so the s-bar method is preferred.
Worked example
The code below uses three subgroups of five measurements. The first function implements R-bar/d2. The second computes the overall standard deviation for comparison.
from statistics import mean, stdev
D2 = {2: 1.128, 3: 1.693, 4: 2.059, 5: 2.326,
6: 2.534, 7: 2.704, 8: 2.847, 9: 2.970, 10: 3.078}
def sigma_within(subgroups):
n = len(subgroups[0])
if any(len(g) != n for g in subgroups):
raise ValueError("all subgroups must have the same size")
r_bar = mean(max(g) - min(g) for g in subgroups)
return r_bar / D2[n]
def sigma_overall(subgroups):
return stdev([x for g in subgroups for x in g])
stable = [
[10.01, 10.03, 9.99, 10.02, 10.00],
[10.04, 10.00, 10.02, 10.01, 10.03],
[9.98, 10.01, 10.00, 10.02, 9.99],
]
# Same scatter inside each subgroup, but the level drifts upward.
drifting = [[x + shift for x in g] for g, shift in zip(stable, (0.0, 0.05, 0.10))]
print(round(sigma_within(stable), 4), round(sigma_overall(stable), 4))
print(round(sigma_within(drifting), 4), round(sigma_overall(drifting), 4))The output is:
0.0172 0.0169
0.0172 0.0423Each subgroup has a range of 0.04, so R-bar is 0.04 and the within sigma is 0.04 / 2.326 = 0.0172.
For the stable data, the two sigmas agree closely. That agreement is what you expect when all the variation is within-subgroup scatter.
For the drifting data, every subgroup still has a range of 0.04, so the within sigma does not change. The overall sigma is about 2.5 times larger because the level moves between subgroups.
With limits of 9.85 and 10.15, the tolerance width is 0.30. Using the within sigma, Cp is 0.30 / (6 × 0.0172), about 2.9. Using the drifting overall sigma, the same ratio is about 1.2. The first figure says what the process can do when it holds still. The second says how it actually behaved.
Choosing an estimator
The alternatives work like this:
- Individuals data. When each reading stands alone, take the moving range, which is the absolute difference between consecutive readings. Divide the average moving range by 1.128, the d2 value for n = 2.
- Large subgroups. Compute the sample standard deviation s of each subgroup, average them to get s-bar, and divide by c4 for that size. The standard deviation s is a slightly biased estimate of sigma, and c4 corrects the bias.
- Pooled standard deviation. Statistical packages often report a pooled within sigma, which combines the subgroup variances weighted by degrees of freedom. It is close to s-bar/c4 and is the usual default in capability software.
All of these estimate the same quantity. They differ in efficiency and in how they treat unusual subgroups.
Why the plain standard deviation is not used
You might ask why we do not just calculate the standard deviation of all the data and skip the subgroups. If the process is perfectly stable, the two estimates agree, as the first output line shows. If the process is not stable, the overall standard deviation grows with every shift and drift, and a bigger sigma makes Cp and Cpk look worse.
That penalty may be what you want when judging actual performance. It is not what Cp and Cpk are meant to show. They separate two questions: how much scatter does the process have when it is in control, and how well does it hold its level over time? Using the within sigma answers the first. Comparing it with the overall sigma helps answer the second.
Common errors
- Wrong d2 for the subgroup size. Using 2.326 for subgroups of four gives a sigma about 13% too low. Always read d2 from the actual n.
- Mixed subgroup sizes. If some subgroups have 4 values and others have 5, use a pooled standard deviation or compute separate R/d2 values and average them. Do not average raw ranges across sizes.
- Subgroups that hide variation. If one subgroup spans a tool change, its range is inflated and the estimate absorbs a special cause. If subgroups are taken too narrowly, such as five consecutive parts from one fixture cavity when there are four cavities, between-cavity variation lands between subgroups and the within sigma is too low.
- Computing sigma before checking stability. An out-of-control range chart means R-bar is not a reliable summary of a single process. Investigate and remove special causes first, or report that the process is not stable.
- Rounding d2 and sigma too early. Keep the full constants through the calculation and round only the final index.
Sampling error in sigma
R-bar/d2 is an estimate and carries error. With 25 subgroups of 5 (125 values), the estimate is typically within about 7 to 8% of the true sigma. With 5 subgroups of 5, the error can be 15% or more. This error passes directly into Cp and Cpk, and a later chapter returns to it when discussing confidence in a reported Cpk.
Exercise
A process is sampled in 25 subgroups of size 4. The average subgroup range is 0.30 mm. Estimate the within-subgroup sigma, and then compute Cp for specification limits of 49.0 and 51.0 mm.
Show answer
For n = 4, d2 = 2.059, so sigma_within = 0.30 / 2.059 = 0.1457 mm. The tolerance width is 51.0 − 49.0 = 2.0 mm, so Cp = 2.0 / (6 × 0.1457) = 2.0 / 0.874 = 2.29, about 2.3.
Exercise
For the same data, a colleague computes the standard deviation of all 100 readings and gets 0.31 mm. Which index does this value produce when used in the same formula, and what does the difference from 0.1457 mm tell you about the process?
Show answer
Using 0.31 mm gives 2.0 / (6 × 0.31) = 1.08, which is Pp, not Cp. The overall sigma is more than twice the within sigma, so most of the variation occurs between subgroups, such as drift or shifts in the process level. The process is capable in the short term but does not hold its level over time, so look for the source of the between-subgroup variation.
Exercise
Individual readings 5.2, 5.5, 5.1, 5.4, 5.3 are taken one at a time. Estimate sigma_within from the moving range.
Show answer
The moving ranges are |5.5 − 5.2| = 0.3, |5.1 − 5.5| = 0.4, |5.4 − 5.1| = 0.3, and |5.3 − 5.4| = 0.1. Their average is 1.1 / 4 = 0.275. Dividing by 1.128 gives sigma_within = 0.244. With only five readings this is a rough estimate, and you would normally want many more.