Skip to content

Home / Statistical Tools / Control Charts / p Chart / p Chart How-To

p Chart How-To

This walkthrough builds a complete p chart from twenty shipments of different sizes. The varying size is the point: it is what makes the control limits step instead of running straight, and it is why the center line is not the average of the twenty proportions.

The data is on this page rather than in a file to download. Press Copy for Excel, then paste it into a blank worksheet.

The data

Twenty days of outbound shipments. Each day a different number of orders went out, and each order was checked against the customer's purchase order. Errors is the number found wrong that day; Orders is the number checked.

Errors Orders
6 180
9 220
2 200
8 240
7 190
8 210
4 230
11 200
6 195
5 205
7 215
5 185
7 225
23 235
4 205
5 190
10 210
5 200
7 220
5 180

Day 14 is the one to watch: 23 errors out of 235 orders, where every other day ran between 2 and 11.

Steps

  1. Put the data in Excel

    Press Copy for Excel above the table. In Excel, open a blank worksheet, click cell A1, and press Ctrl+V. Headers land in row 1 and the twenty days in rows 2 through 21.

  2. Start the chart

    From the Excel ribbon: QXL Stat Tools Tab > Control Charts > Attribute Charts > P, NP, and Laney's P'.

  3. Give it the cells

    In the Data Selection window set Selected Range: to A1:B21. Leave Data in Columns selected and First Row/Column is Header checked. Press Next >.

  4. Check the variant and the two columns

    The dialog opens on the Data tab with Variant: already on P. Check Errors in Defectives Column.

  5. Point the sample size at the Orders column

    In the Sample Size group, select Column and choose Orders.

    This is the step that is easy to miss

    Sample Size opens on Constant with n = 1000. Leave it there and the chart is built as though 1000 orders had been checked every day, which produces a straight-limit chart of the wrong proportions and no error message. If your sample sizes are in a column, you must switch to Column yourself.

  6. Finish

    Press Finish. The chart is written to a new worksheet named P Chart and the Control Chart analysis pane opens on the right.

What you should see

One panel with twenty points, its Y axis titled Proportion Defective.

Value
p-bar 0.0348
sigma_Z 1.42
LCL 0

The center line is 0.0348, and it is not the average of the twenty daily proportions. It is the pooled figure: 144 errors across 4,135 orders. Averaging the twenty proportions instead gives 0.0343, close but not the same, and on data with a wider spread of sample sizes the gap is larger. The pooled number is the one the chart draws.

The limits step, and the step goes the way that surprises people. The upper limit is at 0.0758 on the day when 180 orders were checked and at 0.0703 on the day when 240 were. More inspection gives a tighter limit, because a proportion measured from a bigger sample is a more precise estimate. Nineteen days produce thirteen distinct upper limits here, one per distinct sample size.

The lower limit sits on zero for every subgroup. Three standard deviations below 0.0348 is negative at these sample sizes, and a proportion cannot be negative, so it is clamped. Nothing on this chart can be marked for being too low.

Day 14 is out of control. It plots at 23/235 = 0.0979 against its own upper limit of 0.0707, and is drawn in a different color. It is the only marked point.

Where the numbers came from. For any subgroup the standard deviation of the plotted proportion is

\[ \sigma_i = \sqrt{\frac{\bar{p}(1 - \bar{p})}{n_i}} \]

so it shrinks as the sample grows, and the limits are \(\bar{p}\) plus and minus three of those. Only \(n_i\) changes from point to point, which is why the center line is flat and the limits are not. The formulas are on the Math Details page.

And there is a diagnostic you did not ask for. The summary table reports sigma_Z of 1.42, with a three-row Overdispersion Interpretation legend under it. That figure compares the scatter actually present with the scatter the binomial model predicts. It is reported on every p chart and applied on none: applying it is what a Laney P' Chart does.

Only one test is running

An attribute chart opens with Rule 1 only. Rules 2, 3 and 4 are present and unchecked, and rules 5 through 8 are not offered at all on this dialog. So a p chart with no marked points means nothing broke that single test. See the Rules & Display section of the Options page.

Things to try next

  • Switch the variant to NP and watch the center line bend. Set Variant: to NP and finish again. The same data now plots the raw error count rather than the proportion, and because the expected count is \(n_i\bar{p}\), the center line steps too: on day 14 it sits at 8.18 with an upper limit of 16.62. Day 14 is still the only marked point. See the np Chart.
  • Switch to Laney P'. With \(\sigma_Z\) at 1.42 the Laney limits come out about 42 percent wider than these. On this data day 14 stays marked, but on a chart where the diagnostic is larger the difference is dramatic: the Laney P' Chart How-To is built on data where a p chart marks seven points and a Laney P' chart marks none.
  • Turn on the zone lines and note what they mean here. Tick Show 1-sigma / 2-sigma zone lines. On an attribute chart a zone step is one full standard deviation of the plotted statistic, not a third of the band, so at the default multiplier of 3 the lines land at one and two sigma and the band edge at three. Change Number of StDevs: to 2 and the zone lines stay where they are while the limits move in.
  • Turn on the pattern tests. Tick rules 2, 3 and 4 and rebuild. Nothing new is marked on this data.
  • Try Force Straight Limits and watch nothing happen. Tick it, type an assumed n, and finish. The chart is identical: the engine never substitutes an assumed sample size on the p variant. It does on np, where it flattens both the center line and the limits.

See Also