How to use the X-bar & R chart maker
- Enter the data. Paste from a spreadsheet, type, or upload a .csv / .xlsx file with one rational subgroup per row and rows in time order. A header row and a label column are detected automatically. If your measurements are in one long column, choose Single column and enter the subgroup size.
- Pick the chart pair. Auto draws X̄-R for subgroup sizes up to 10 and switches to X̄-S above that.
- Decide where the limits come from: all subgroups, the first k subgroups (a Phase I baseline that is then extended over later data), or known values μ₀ and σ₀. Subgroups with an assignable cause can be excluded from the calculation while staying on the chart.
- Choose the tests — Western Electric or Nelson — and read the verdict, the charts and the list of signals. Add report details and print or save a PDF.
When to use X̄-R, X̄-S or another chart
- X̄-R: continuous measurements collected in subgroups of 2 to about 10 parts made under the same conditions. The range is easy to compute and nearly as efficient as the standard deviation at these sizes.
- X̄-S: subgroups larger than 10, or whenever software does the arithmetic. The range ignores everything except the two extremes, so its efficiency drops as n grows.
- One measurement at a time (batch processes, slow cycles, destructive tests): use the I-MR chart.
- Counts of defectives or defects: use the p, np, c and u charts.
The subgroup must be rational: the parts inside it should differ only by common-cause variation (consecutive parts from one machine, one operator, one material lot), so that changes between subgroups show up as shifts on the X̄ chart.
Formulas and constants
With k subgroups of equal size n, let x̿ be the average of the subgroup means, R̄ the average range and s̄ the average sample standard deviation.
| Chart | Centre line | UCL | LCL |
|---|---|---|---|
| X̄ (with R) | x̿ | x̿ + A₂·R̄ | x̿ − A₂·R̄ |
| R | R̄ | D₄·R̄ | D₃·R̄ |
| X̄ (with S) | x̿ | x̿ + A₃·s̄ | x̿ − A₃·s̄ |
| S | s̄ | B₄·s̄ | B₃·s̄ |
The within-subgroup standard deviation is estimated as σ̂ = R̄ ÷ d₂ or σ̂ = s̄ ÷ c₄. The tool uses the standard published three-decimal constants for n = 2 to 10 and computes them from d₂, d₃ and c₄ for n = 11 to 25.
| n | A₂ | D₃ | D₄ | A₃ | B₃ | B₄ | d₂ | c₄ |
|---|---|---|---|---|---|---|---|---|
| 2 | 1.880 | 0 | 3.267 | 2.659 | 0 | 3.267 | 1.128 | 0.7979 |
| 3 | 1.023 | 0 | 2.574 | 1.954 | 0 | 2.568 | 1.693 | 0.8862 |
| 4 | 0.729 | 0 | 2.282 | 1.628 | 0 | 2.266 | 2.059 | 0.9213 |
| 5 | 0.577 | 0 | 2.114 | 1.427 | 0 | 2.089 | 2.326 | 0.9400 |
| 6 | 0.483 | 0 | 2.004 | 1.287 | 0.030 | 1.970 | 2.534 | 0.9515 |
| 7 | 0.419 | 0.076 | 1.924 | 1.182 | 0.118 | 1.882 | 2.704 | 0.9594 |
| 8 | 0.373 | 0.136 | 1.864 | 1.099 | 0.185 | 1.815 | 2.847 | 0.9650 |
| 9 | 0.337 | 0.184 | 1.816 | 1.032 | 0.239 | 1.761 | 2.970 | 0.9693 |
| 10 | 0.308 | 0.223 | 1.777 | 0.975 | 0.284 | 1.716 | 3.078 | 0.9727 |
Known standards and unequal subgroup sizes
With known μ₀ and σ₀ the X̄ limits are μ₀ ± 3σ₀/√n, the R chart uses d₂σ₀ ± 3d₃σ₀ and the S chart c₄σ₀ ± 3σ₀√(1 − c₄²), with lower limits floored at zero.
If the subgroups are not all the same size, the tool draws stepped limits: the centre line of the X̄ chart is the weighted grand mean Σnᵢx̄ᵢ ÷ Σnᵢ, sigma is the inverse-variance weighted average of the unbiased per-subgroup estimates Rᵢ/d₂(nᵢ) (or sᵢ/c₄(nᵢ)), and each subgroup gets its own limits from its own n. Run and zone tests are then applied to standardised values.
Out-of-control tests: exact definitions
A signal is reported at the point that completes a pattern. Zone tests are evaluated separately on each side of the centre line, using the standard error of the plotted mean.
| Western Electric | Nelson | Definition used |
|---|---|---|
| 1 | 1 | One point above the UCL or below the LCL. |
| 2 | 5 | The point is more than 2σ from the centre line and so is at least one of the two points before it, on the same side. |
| 3 | 6 | The point is more than 1σ from the centre line and so are at least three of the four points before it, on the same side. |
| 4 (8 points) | 2 (9 points) | The point and the 7 (or 8) before it are all on the same side of the centre line. A point exactly on the line breaks the run. |
| — | 3 | Six points in a row, each higher than the one before (or each lower). Ties break the trend. |
| — | 4 | Fourteen points in a row alternating up, down, up, down. |
| — | 7 | Fifteen points in a row all within 1σ of the centre line (stratification). |
| — | 8 | Eight points in a row all more than 1σ from the centre line, on either side (mixture). |
Every extra test raises the false-alarm rate. Rule 1 alone gives about 1 false signal in 370 points for a stable normal process; the four Western Electric rules together give roughly 1 in 90. That is why the less common Nelson tests are off by default. The R and S charts are tested with rule 1 (and optionally the run and trend tests), because their sampling distributions are not symmetric.
How to read the charts
Read the R or S chart first. It shows whether the short-term spread is stable, and the X̄ limits are calculated from it. A point above the upper limit means a subgroup with unusually large spread: a mixed lot, a loose fixture, a measurement error. Only when the spread is in control do the X̄ limits mean anything. On the X̄ chart, a point outside the limits or a run on one side indicates that the process average has moved — tool wear, a set-up change, a new material batch. Find and remove the assignable cause, exclude those subgroups, and recalculate. Control limits describe what the process does; whether that is good enough for the specification is a separate question answered by the process capability calculator, and only once the chart is stable.
Worked example (the sample data)
The sample is a turned shaft diameter, 25 subgroups of n = 5. The subgroup means average x̿ = 25.0014 mm and the ranges average R̄ = 0.01848 mm. For n = 5, A₂ = 0.577, D₃ = 0, D₄ = 2.114 and d₂ = 2.326.
- X̄ chart: UCL = 25.0014 + 0.577 × 0.01848 = 25.0121; LCL = 25.0014 − 0.577 × 0.01848 = 24.9907.
- R chart: UCL = 2.114 × 0.01848 = 0.0391; LCL = 0.
- σ̂ = 0.01848 ÷ 2.326 = 0.00794 mm.
Subgroup 9 has a mean of 25.0140 mm, above the UCL — a rule 1 signal — and the later subgroups run above the centre line. The R chart is in control, so the spread is stable and the signals point to changes in the process level.
The limit formulas and constants follow the AIAG SPC reference manual and Montgomery’s Introduction to Statistical Quality Control. The tool reproduces Montgomery’s hard-bake flow-width example (25 subgroups of 5: x̿ = 1.5056, R̄ = 0.32521, X̄ limits 1.318 and 1.693, R chart UCL 0.68749). The charts assume roughly normal, independent measurements; check the distribution with the normality test or a histogram, and make sure the gauge is adequate with a gage R&R study.
Frequently asked questions
When should I use an X-bar & S chart instead of an X-bar & R chart?
Use X-bar & S when the subgroup size is larger than about 10, or whenever the calculation is done by software. The range only uses the largest and smallest value in a subgroup, so it becomes an inefficient estimate of spread as the subgroup grows. For subgroups of 2 to 10 the two charts give almost the same limits.
How many subgroups do I need to calculate control limits?
The usual recommendation is 20 to 25 subgroups (about 100 individual measurements) collected while the process runs normally. Limits from fewer subgroups can be calculated but should be treated as trial limits and recalculated when more data are available.
What are A2, D3 and D4?
They are control chart constants that depend only on the subgroup size n. A2 converts the average range into 3-sigma limits for the subgroup mean (A2 = 3 / (d2 × √n)), and D3 and D4 give the lower and upper 3-sigma limits of the range chart as multiples of the average range. For n = 5 they are 0.577, 0 and 2.114.
Why is the lower control limit of the R chart zero?
For subgroup sizes of 6 or fewer, the calculated lower 3-sigma limit for the range is negative, and a range cannot be negative, so D3 is set to 0 and the chart has no lower limit. From n = 7 upward D3 is positive.
Are control limits the same as specification limits?
No. Control limits are calculated from the process data and show the natural variation of subgroup averages. Specification limits come from the drawing and apply to individual parts. Never draw specification limits on an X-bar chart, because averages vary less than individual values.
Can I use subgroups of different sizes?
Yes. This tool then draws stepped limits: each subgroup gets its own limits calculated from its own size, around a weighted grand mean and a pooled estimate of sigma. Equal subgroup sizes are still preferable because the chart is easier to read.