Sub topic 8
X-bar and R Charts: Means and Ranges of Subgroups
Prerequisites and purpose
Assume you know how to calculate a mean and a range. A subgroup is a small set of measurements collected under nearly the same conditions. An X-bar and R chart monitors two features of each subgroup:
- The X-bar chart monitors the subgroup mean, or average.
- The R chart monitors the subgroup range, calculated as the largest value minus the smallest value.
Use these charts when you can collect repeated measurements in rational subgroups, usually with 2 to 10 observations per subgroup. The two charts work together. The R chart checks short-term variation within subgroups. The X-bar chart checks whether subgroup averages change over time.
Chart formulas
Suppose subgroup i contains n measurements. Calculate its mean and range:
- X-bar: the average of the subgroup measurements.
- R: the maximum measurement minus the minimum measurement.
Then calculate:
- X-bar-bar: the average of all subgroup means.
- R-bar: the average of all subgroup ranges.
For subgroup size n, use constants from a control-chart table:
| Chart | Center line | Lower control limit | Upper control limit |
|---|---|---|---|
| X-bar | X-bar-bar | X-bar-bar − A2 R-bar | X-bar-bar + A2 R-bar |
| R | R-bar | D3 R-bar | D4 R-bar |
The constants A2, D3, and D4 depend on subgroup size. For subgroups of five, A2 = 0.577, D3 = 0, and D4 = 2.114. The R chart has a zero lower limit in this case because a range cannot be negative.
Control limits estimate the expected spread of a stable process. They are not targets or customer requirements.
Worked example in Python
The following example uses five subgroups, each containing five measurements. It calculates the center lines and three-sigma control limits.
import numpy as np
# Constants for subgroup size n = 5
A2, D3, D4 = 0.577, 0.0, 2.114
# Each row is one subgroup of 5 measurements
data = np.array([
[5.02, 4.98, 5.01, 5.00, 4.99],
[5.03, 5.00, 4.97, 5.01, 5.02],
[4.99, 5.01, 5.00, 5.04, 4.98],
[5.00, 5.02, 4.96, 5.01, 5.00],
[5.01, 4.99, 5.03, 5.00, 4.97],
])
xbars = data.mean(axis=1)
ranges = data.max(axis=1) - data.min(axis=1)
xbarbar = xbars.mean()
rbar = ranges.mean()
xbar_ucl = xbarbar + A2 * rbar
xbar_lcl = xbarbar - A2 * rbar
r_ucl = D4 * rbar
r_lcl = D3 * rbar
print(xbar_lcl, xbarbar, xbar_ucl)
print(r_lcl, rbar, r_ucl)The first output line gives the lower limit, center line, and upper limit for the X-bar chart. The second gives the same values for the R chart.
Reading the two charts together
The usual order is to examine the R chart first. If the R chart has an out-of-limit point, within-subgroup variation is unstable. In that case, interpret the X-bar chart cautiously because its limits depend on R-bar.
A stable R chart with an unstable X-bar chart suggests that subgroup averages are shifting while short-term variation remains similar. Possible causes include a changed machine setting, material batch, operator, or environmental condition.
A useful process view is:
Common errors
- Using constants for the wrong subgroup size.
- Mixing measurements from different conditions into one subgroup.
- Treating specification limits as control limits.
- Ignoring an unstable R chart while interpreting the X-bar chart.
- Recalculating limits after every unusual point instead of using a defined baseline period.
- Assuming that a point inside the limits proves the process is capable of meeting specifications.
Exercise
A subgroup of five measurements has a range above the R-chart upper control limit, but its mean is inside the X-bar limits. Which chart should you investigate first, and why?
Show answer
Investigate the R chart first. The out-of-limit range signals unstable within-subgroup variation, so the X-bar result may not be reliable until the cause of that variation is understood.