p-Chart Control Limits: Variable Sample Size, 3-Sigma Formulas, and Laney p-Prime
What the p-Chart Monitors and When to Use It
The p-chart tracks the proportion of defective items in a sample over time. It is the attribute control chart you use when each inspected unit is classified as either conforming or nonconforming (pass/fail, good/bad) and your sample sizes may vary between inspection periods. If you need to calculate control limits for a p chart, the formulas are straightforward—but the variable-sample-size complication is where most implementations go wrong.
This guide walks through the complete calculation with real inspection data, covers the variable-n problem, and introduces the Laney p’ chart for situations where standard p-chart limits are too tight.
p-Chart Formulas: The Foundation
The p-chart uses the binomial distribution to set control limits around the average proportion defective. The core formulas:
where \(\bar{p}\) is the overall proportion defective, \(n\) is the sample size, and the ±3 represents three standard deviations (the standard Shewhart convention). If LCL calculates below zero, set it to zero—a negative proportion has no physical meaning.
The critical detail: n appears inside the square root. When sample sizes vary, the control limits change width from period to period. Larger samples produce tighter limits; smaller samples produce wider limits. This is not a flaw—it reflects the statistical reality that larger samples give more precise estimates of the true proportion.
Worked Example: PCB Solder Defect Inspection
An electronics manufacturer inspects printed circuit boards after wave soldering. Each board is classified as conforming or nonconforming based on visual and automated optical inspection. Here are 15 inspection periods with varying sample sizes:
| Period | Inspected (n) | Defective (d) | Proportion (p) |
|---|---|---|---|
| 1 | 200 | 8 | 0.040 |
| 2 | 180 | 6 | 0.033 |
| 3 | 220 | 10 | 0.045 |
| 4 | 200 | 7 | 0.035 |
| 5 | 190 | 9 | 0.047 |
| 6 | 210 | 5 | 0.024 |
| 7 | 200 | 8 | 0.040 |
| 8 | 175 | 11 | 0.063 |
| 9 | 220 | 7 | 0.032 |
| 10 | 200 | 6 | 0.030 |
| 11 | 185 | 8 | 0.043 |
| 12 | 210 | 9 | 0.043 |
| 13 | 195 | 7 | 0.036 |
| 14 | 200 | 12 | 0.060 |
| 15 | 205 | 6 | 0.029 |
Step 1: Calculate the Overall Proportion Defective
$$\bar{p} = \frac{8+6+10+7+9+5+8+11+7+6+8+9+7+12+6}{200+180+220+200+190+210+200+175+220+200+185+210+195+200+205}$$ $$\bar{p} = \frac{119}{2990} = 0.0398$$Step 2: Calculate Control Limits for Each Period
Because sample sizes vary from 175 to 220, the control limits differ at each point. Here are the calculations for three representative periods:
Period 1 (n=200):
$$UCL = 0.0398 + 3\sqrt{\frac{0.0398 \times 0.9602}{200}} = 0.0398 + 3(0.01382) = 0.0398 + 0.0415 = 0.0813$$ $$LCL = 0.0398 - 0.0415 = -0.0017 \rightarrow 0$$Period 8 (n=175, smallest sample):
$$UCL = 0.0398 + 3\sqrt{\frac{0.0398 \times 0.9602}{175}} = 0.0398 + 3(0.01478) = 0.0398 + 0.0443 = 0.0841$$ $$LCL = 0.0398 - 0.0443 = -0.0045 \rightarrow 0$$Period 3 (n=220, largest sample):
$$UCL = 0.0398 + 3\sqrt{\frac{0.0398 \times 0.9602}{220}} = 0.0398 + 3(0.01318) = 0.0398 + 0.0395 = 0.0793$$ $$LCL = 0.0398 - 0.0395 = 0.0003$$Note: the chart above uses n=200 limits for visual clarity. In a production system, you would plot the variable limits that widen for smaller samples and narrow for larger ones.
Step 3: Interpret the Results
All 15 points fall within the control limits. Period 8 (p=0.063) is the highest point but stays below its UCL of 0.0841. Period 14 (p=0.060) also stays within bounds. The process is in statistical control at an average defect rate of approximately 4%.
No Western Electric rule violations are present. The process is stable but may not be satisfactory—whether a 4% defect rate is acceptable depends on your quality targets and customer requirements.
The Variable Sample Size Problem: Three Approaches
The per-period limit calculation above is the statistically correct method, but it creates a chart with wobbly control limit lines that can confuse operators. Three common approaches in practice:
- Exact limits per period (recommended): Calculate unique UCL and LCL for each period using that period’s actual n. Statistically correct but visually complex. Best when sample sizes vary significantly (>±25% from average).
- Average-n limits (common shortcut): Use the average sample size (\(\bar{n}\)) in the formula. Produces straight control limit lines. Acceptable when sample sizes vary by less than ±25% from the average. In our example: \(\bar{n} = 2990/15 = 199.3\), so average-n limits would be close to the n=200 calculation above.
- Standardized p-chart: Transform each proportion into a z-score: \(Z_i = (p_i - \bar{p}) / \sqrt{\bar{p}(1-\bar{p})/n_i}\). Plot Z values against constant limits of ±3. Handles any sample size variation, but operators find z-scores harder to interpret than proportions.
Beyond the Standard p-Chart: Overdispersion and the Laney p’ Chart
Standard p-chart limits assume that the only source of variation in the proportion defective is the binomial sampling variation. In practice, real manufacturing processes often show overdispersion—more variation than the binomial model predicts. Common causes include:
- Lot-to-lot material variation (incoming material quality shifts between batches)
- Operator differences across shifts
- Environmental changes (temperature, humidity affecting the process)
- Multiple defect modes with different base rates combined into a single pass/fail classification
When overdispersion is present, the standard p-chart control limits are too tight, producing an excessive false alarm rate. The chart will show many points outside the limits even though the process has not changed—the limits simply do not reflect the true process variation.
The Laney p’ (p-prime) chart addresses this by adding a sigma-Z adjustment factor. It calculates the standard p-chart z-scores, then estimates the between-subgroup variation in those z-scores using a moving range. The adjustment inflates (or deflates) the control limits to match the actual observed variation. The Laney p’ chart was introduced by David Laney in 2002 and is now available in Minitab and other SPC software.
Use the Laney p’ chart when:
- Your sample sizes are very large (n > 1000) and the standard p-chart shows too many out-of-control signals
- You have confirmed that the out-of-control signals do not correspond to real assignable causes
- The process has known sources of extra-binomial variation that are part of its normal operating conditions
Minimum Data Requirements for Reliable p-Chart Limits
Control limit reliability depends on having enough data. The AIAG SPC Reference Manual and standard SPC texts recommend:
- Minimum 25 subgroups for the initial study (our 15-period example is illustrative; a real initial study would need more data)
- Minimum np ≥ 5 per subgroup—the expected number of defectives in each sample should be at least 5 for the normal approximation to the binomial to be reasonable. At \(\bar{p} = 0.04\), you need \(n \ge 125\) per period
- If np < 5, the normal approximation breaks down and the 3-sigma limits are unreliable. Consider increasing sample size, using exact binomial limits, or switching to a different chart approach
For capability analysis after establishing control, see our comparison of Cpk and Ppk indices. Note that Cpk applies to variable data; for attribute data, the equivalent capability measure is the defect rate itself or the sigma level derived from it.
Key Takeaways
- The p-chart monitors the proportion defective using binomial-based 3-sigma limits: \(\bar{p} \pm 3\sqrt{\bar{p}(1-\bar{p})/n}\)
- When sample sizes vary, recalculate limits per period (exact method) or use the average n if variation is within ±25%
- Set LCL to zero when the formula yields a negative value
- Watch for overdispersion—if your standard p-chart shows chronic false alarms with no assignable causes, consider the Laney p’ chart
- Ensure np ≥ 5 per subgroup for reliable limits; increase sample size if your defect rate is low