1. Home
2. SPSHEWHART procedure

# SPSHEWHART procedure

Plots control charts for mean and standard deviation or range (A.F. Kane & R.W. Payne).

### Options

`PRINT` = string token What to print (`warnings`); default `*` i.e. nothing Type of chart to plot to accompany the chart of sample means (`range`, `standarddeviation`); default `stan` Type of control limits (`probability`, `sigma`); default `sigm` Multiplier to use to test whether to use mean sample size for control limits; default 1 Probability value(s) to use to calculate control limits when `METHOD=probability`; default 0.01, 0.025 Which high-resolution graphics windows to use; if unset `SPSHEWHART` automatically sets up two windows containing the upper and lower halves of the screen Whether or not to clear the graphics screen before plotting (`clear`, `keep`); default `clea`

### Parameters

`DATA` = variates or pointers Data measurements Factor identifying samples or scalar indicating the size of each sample Sets or saves the sample mean value Sets or saves the sample standard deviation

### Description

`SPSHEWHART` plots the standard charts devised by Shewhart (1931) for the control of manufacturing processes. The data values consist of samples of measurements made on successive occasions, which are specified by the `DATA` and `SAMPLES` parameters. `DATA` can be set to a variate containing the measurement and `SAMPLES` to a factor identifying the samples. Alternatively, if the samples are all of the same size and occur in the `DATA` variate one sample at a time, you can set `SAMPLES` to a scalar indicating the size of each sample. Finally, if the samples are in separate variates, you can set `DATA` to a pointer containing the variates (`SAMPLES` is then unset).

Two charts are produced. The first chart plots the mean of each sample. It also contains a centre line (indicating a target value) and lines representing upper and lower control limits (bounding the zone outside which the process is said to be out of control). The `MEAN` and `SIGMA` parameters allow you to supply values for the process mean and standard deviation if these are available either as targets or from previous observations. If they are unset, or if they are set to scalars containing missing values, the values are calculated from the data values (see the Methods Section). The traditional chart (and the one that is most popular in the USA) sets the centre line at the mean, and the control limits at 3 × `SIGMA` and -3 × `SIGMA` from the mean. The alternative (often used in the UK and requested by setting option `METHOD` to `probability`) sets control limits according to probability values. Usually the lower control limit is at the equivalent deviate value for a probability of 0.01, and the upper limit is at the value for 0.99 (see the Methods Section). There may also be intermediate warning limits, usually at 0.025 and 0.975. These are the default probabilities used by `SPSHEWHART`, but you can set the `PROBABILITY` option to a variate containing one or two values to define other limits. (If the values are p1 and p2, the limits are then for probabilities p1, p2, 100-p2, 100-p1.)

The control limits relevant to each batch will depend on the sample sizes. The `TOLERANCE` option determines whether an average sample size is used if the individual sizes are not exactly equal: this will happen unless either

`MIN(sample_size) * TOLERANCE < MEAN(sample_size)`

or

`MEAN(sample_size) * TOLERANCE < MAX(sample_size)`

The second chart is either for the standard deviation of values in each sample or for their range, according to the setting of the `PLOT` option (by default `PLOT=standarddeviation`). Traditionally, before computers were available, the range chart was more popular. However, it is less sensitive than the standard deviation, particularly for larger samples, and `SPSHEWHART` does not permit range charts if any sample size is greater than 25.

If the number in each sample is one, the chart of the means is known as an individuals chart. There is now no within-sample replication, so the range chart instead presents a moving range displaying the range between each sample and the previous sample. Similarly, the standard deviations are calculated between each sample and its previous sample.

You can set `PRINT=warnings` to list any batches that are outside the control limits; by default these are suppressed. As usual, the `WINDOWS` option specifies which high-resolution graphics windows to use for the plots. If this is unset, `SPSHEWHART` automatically sets up and uses two windows containing the upper and lower halves of the screen. The `SCREEN` option controls whether or not to clear the graphics screen before plotting the charts.

Options: `PRINT`, `PLOT`, `METHOD`, `TOLERANCEMULTIPLIER`, `PROBABILITY`, `WINDOWS`, `SCREEN`.

Parameters: `DATA`, `SAMPLES`, `MEAN`, `SIGMA`.

### Method

`SPSHEWHART` follows the standard methods as described for example by Nelson (1982), Montgomery (1985) or Ryan (1989). If required, the mean is estimated in the usual way by the average of the sample values. Likewise, the standard deviation is estimated by the average of the standard deviations of the samples, divided by a bias correction constant c4:

c4 = √(2/n) × `GAMMA`(n/2) / `GAMMA`((n-1)/2)

where n is the sample size.

First of all we describe the calculations with `METHOD=sigma`. In the mean chart, the centre line is at the mean (i.e. `MEAN`), and the control limits at `MEAN` + 3 × `SIGMA` and `MEAN` – 3 × `SIGMA`. In the range chart, if the standard deviation has been supplied, the centre line is at d2 × `SIGMA` and the control limits at D1 × `SIGMA` and D2 × `SIGMA`; if the standard deviation has not been supplied, the centre line is at the mean of the ranges observed in the samples, and the control limits are at D3 × `SIGMA` and D4 × `SIGMA`. (See Appendix VI of Montgomery, or Nelson 1982 Table 1 for values of the constants d2, and D1-D4.) In the standard-deviation chart, the centre line is at `SIGMA` × c4 (so that it exhibits the same bias as the sample standard deviations) and the control limits are at 3 × `SIGMA` × √(1 – c4 2) above and below the centre line.

For `METHOD=probability`, the centre lines are unaffected. However, the control limits for the means chart are now at

`EDNORMAL(PROBABILITY) * SIGMA / SQRT(N)`

above and below the centre line. For the range chart, the control limits are at

`SIGMA * EDSRANGE(PROBABILITY; 1000; N)`

and

`SIGMA * EDSRANGE(1-PROBABILITY; 1000; N)`

(where the high value 1000 used for the degrees of freedom of the Studentized range is to obtain the value for the Normal range). For the standard-deviation chart, the control limits are at

`SQRT(EDCHI(PROBABILITY; N-1) / (N-1))`

and

`SQRT(EDCHI(1-PROBABILITY; N-1) / (N-1))`

### Action with `RESTRICT`

Neither the `DATA` variates nor the `SAMPLE` factors may be restricted.

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

Nelson, L.S. (1982). Control charts. In: Encyclopedia of Statistical Sciences (ed. S. Kotz, N.L. Johnson & C.B. Read), Volume 2, 176-183. Wiley, New York.

Ryan, T.P. (1989). Statistical Methods for Quality Improvement. Wiley, New York.

Shewhart, W.A. (1931). Economic Control of Quality of Manufactured Product. Van Nostrand, New York.

### See also

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

Commands for: Six sigma.

### Example

```CAPTION    'SPSHEWHART example',\
!t('1) Data from Montgomery (1985), Introduction',\
'to Statistical Process Control, page 207.'); STYLE=meta,plain
VARIATE    Diameter
READ       Diameter
74.030 74.002 74.019 73.992 74.008
73.995 73.992 74.001 74.011 74.004
73.988 74.024 74.021 74.005 74.002
74.002 73.996 73.993 74.015 74.009
73.992 74.007 74.015 73.989 74.014
74.009 73.994 73.997 73.985 73.993
73.995 74.006 73.994 74.000 74.005
73.985 74.003 73.993 74.015 73.988
74.008 73.995 74.009 74.005 74.004
73.998 74.000 73.990 74.007 73.995
73.994 73.998 73.994 73.995 73.990
74.004 74.000 74.007 74.000 73.996
73.983 74.002 73.998 73.997 74.012
74.006 73.967 73.994 74.000 73.984
74.012 74.014 73.998 73.999 74.007
74.000 73.984 74.005 73.998 73.996
73.994 74.012 73.986 74.005 74.007
74.006 74.010 74.018 74.003 74.000
73.984 74.002 74.003 74.005 73.997
74.000 74.010 74.013 74.020 74.003
73.988 74.001 74.009 74.005 73.996
74.004 73.999 73.990 74.006 74.009
74.010 73.989 73.990 74.009 74.014
74.015 74.008 73.993 74.000 74.010
73.982 73.984 73.995 74.017 74.013 :
SPSHEWHART [PRINT=warnings] Diameter; SAMPLES=5
SPSHEWHART [PRINT=warnings; PLOT=range] Diameter; SAMPLES=5
SPSHEWHART [PRINT=warnings; PLOT=range; METHOD=probability]\
Diameter; SAMPLES=5
CAPTION '2) Individuals chart, data from Montgomery (1985), page 242.'
VARIATE [VALUES=33.75,33.05,34.00,33.81,33.46,34.02,33.68,33.27,33.49,33.20,\
33.62,33.00,33.54,33.12,33.84] Viscosity
SPSHEWHART [PRINT=warnings] Viscosity; SAMPLES=1
SPSHEWHART [PRINT=warnings; PLOT=range] Viscosity; SAMPLES=1
```