1. Home
2. SPPCHART procedure

# SPPCHART procedure

Plots p or np charts for binomial testing for defective items (A.F. Kane & R.W. Payne).

### Options

`PRINT` = string token What to print (warnings); default * i.e. nothing Type of chart to plot (`p`, `np`); default `p` Method to use to obtain the control limits (`complementaryloglog`, `given`, `logit`, `probit`, `untransformed`); default `untr` Multiplier to use to test whether to use mean sample size for control limits; default 1 Which high-resolution graphics window to use; default 3 Whether or not to clear the graphics screen before plotting (`clear`, `keep`); default `clea`

### Parameters

`NDEFECTIVE` = variates Number of defective items Number of items tested Sets or saves centre line Sets or saves lower control limit Sets or saves upper control limit

### Description

The p and np charts are used in statistical process control to evaluate testing schemes in which successive batches of items are classified as either good or defective. The number of defective items in each batch is specified, in a variate, by the `NDEFECTIVE` parameter. The `NTESTED` parameter supplies the number of items in each batch – this can be a scalar if the batches are all of the same size, otherwise it is a variate.

The `PLOT` option controls the type of chart: the p chart plots the proportion of defective items while the np chart (which is most useful each batch of items has the same total size) plots the number of defective items.

The charts contain not only the observed numbers or proportions but also a centre line (indicating a target value) and lines showing upper and lower control limits (bounding the zone outside which the process is said to be out of control). The control limits relevant to each batch will depend on the batch sizes. The `TOLERANCE` option determines whether an average total size is used if the individual totals are not exactly equal: this will happen unless either

`MIN(NTESTED) * TOLERANCE < MEAN(TESTED)`

or

`MEAN(TESTED) * TOLERANCE < MAX(NTESTED)`

The `METHOD` option specifies how the various lines are to be defined, with the following settings. They are defined below for a p chart. For an np chart, the values are simple multiplied by the batch size(s).

    `untransformed` this is the default setting, and requests the method conventionally used in SPC. The centre line is at p = (total number defective) / (total number tested) and the limits are at p + 3 × √(p / (1-p)) specifies that the values are supplied by the `CENTRELINE`, `LOWERCONTROLLIMIT` and `UPPERCONTROLLIMIT` parameters. obtains the values as the batch mean +/- three times its standard error as estimated on the logit scale of a generalized linear model (with binomial distribution). obtains the values as the batch mean +/- three times its standard error as estimated on the probit scale of a generalized linear model obtains the values as the batch mean +/- three times its standard error as estimated on the complementary-log-log scale of a generalized linear model.

For settings of `METHOD` other than `given`, the `CENTRELINE`, `LOWERCONTROLLIMIT` and `UPPERCONTROLLIMIT` parameters can be used to save the centre line and limits.

You can set `PRINT=warnings` to list any batches that are outside the control limits; by default these are suppressed. As usual, the `WINDOW` option specifies which high-resolution graphics window to use for the plot, and the `SCREEN` option controls whether or not to clear the graphics screen before plotting.

Options: `PRINT`, `PLOT`, `METHOD`, `TOLERANCEMULTIPLIER`, `WINDOW`, `SCREEN`.

Parameters: `NDEFECTIVE`, `NTESTED`, `CENTRELINE`, `LOWERCONTROLLIMIT`, `UPPERCONTROLLIMIT`.

### Method

For further information about the standard SPC methods see for example Chapter 5 of Montgomery (1985). Section 3.5 of the Guide to the Genstat Command Language, Part 2 Statistics gives more details about generalized linear models.

### Action with `RESTRICT`

Any restrictions are ignored.

### Reference

Montgomery, D.C. (1985). Introduction to Statistical Process Control. Wiley, New York.

### See also

Procedures: `SPCAPABILITY`, `SPCCHART`, `SPCUSUM`, `SPEWMA`, `SPSHEWHART`.

Commands for: Six sigma.

### Example

```CAPTION  'SPPCHART example',\
!t('Data from Montgomery (1985), Introduction to',\
'Statistical Process Control, page 152.');\
STYLE=meta,plain
VARIATE  [VALUES=12,15,8,10,4,7,16,9,14,10,5,6,17,12,22,\
8,10,5,13,11,20,18,24,15,9,12,7,13,9,6] Cans
SPPCHART [PRINT=warnings] Cans; NTESTED=50
```
Updated on March 5, 2019