1. Home
2. SPEWMA procedure

# SPEWMA procedure

Plots exponentially weighted moving-average control charts (A.F. Kane & R.W. Payne).

### Options

`PRINT` = string token What to print (`warnings`); default `*` i.e. nothing Multiplier to use to test whether to use mean sample size for control limits; default 1 Weight parameter used in the calculation of the exponentially weighted moving-average statistic; default 0.25 Number of multiples of sigma to use for control limits; default 3 Which high-resolution graphics window to use; default 3 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

`SPEWMA` plots exponentially weighted moving-average control charts for controlling the mean of a process. 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).

The chart plots a statistic w whose value for sample t is a weighted average of the mean of sample t, and the value of the statistic for sample t-1:

wt = rt × xbart + (1 – r) × wt1

where xbar is the variate of sample means, and r is the weighting parameter specified by the `WEIGHT` option of the procedure with default 0.25. (Notice that the statistic involves all the previous means, but with exponentially decreasing weights.)

The position of the central line for the chart is specified, in a scalar, by the `MEAN` parameter. If this is not set, or if it is set to a scalar containing a missing value, the overall mean of the samples is used. (So you can save the calculated mean by setting `MEAN` to a scalar containing a missing value.) There are also control lines –nsigma × var(w) and +nsigma × var(w), where nsigma is specified by the `NSIGMA` option (default 3) and var(w) is the variance of the statistic w. For sample t, this is

(3 × sigma / √(`REP`t)) × √( (r/(2 – r)) × (1 – (1 – r)2t) )

where `REP` is a variate containing the number of observations in each sample, and sigma is the standard deviation of a single observation. The `SIGMA` parameter can be used to supply a value for sigma. It this is not set or if it is set to a missing value, sigma is calculated using the within-sample replication as 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)

The `TOLERANCE` option determines whether an average replication is used if the replication of the individual samples is no exactly equal: this will happen unless either

`MIN(REP) * TOLERANCE < MEAN(rep)`

or

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

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 window to use for the plot (default 3), and the `SCREEN` option controls whether or not to clear the graphics screen before plotting the charts.

Options: `PRINT`, `TOLERANCEMULTIPLIER`, `WEIGHT`, `NSIGMA`, `WINDOW`, `SCREEN`.

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

### Method

Further details of the method, and advice on the setting of the weight parameter, can be found for example in Ryan (1989) Section 5.5.

### Action with `RESTRICT`

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

### Reference

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

### See also

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

Commands for: Six sigma.

### Example

```CAPTION   'SPEWMA example',\
!t('Data from Montgomery (1985), Introduction to',\
'Statistical Process Control, page 303.'); STYLE=meta,plain
VARIATE   [VALUES=10.5,6.0,10.0,11.0,12.5,9.5,6.0,10.0,10.5,14.5,\
9.5,12.0,12.5,10.5,8.0,9.5,7.0,10.0,13.0,9.0,\
12.0,6.0,12.0,15.0,11.0,7.0,9.5,10.0,12.0,8.0,\
9.0,13.0,11.0,9.0,10.0,15.0,12.0,8.0] xbar_t
SPEWMA    [WEIGHT=0.2] xbar_t; SAMPLES=1; MEAN=10; SIGMA=2
```
Updated on March 5, 2019