Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
MACHART Statement

Constructing Uniformly Weighted Moving Average Charts

The following notation is used in this section:
Aiuniformly weighted moving average for the i th subgroup
wspan parameter (number of terms in moving average)
\muprocess mean (expected value of the population of measurements)
\sigmaprocess standard deviation (standard deviation of the population of measurements)
xijj th measurement in i th subgroup, with j =1, 2, 3, ..., ni
nisample size of i th subgroup
\overline{X}_{i}mean of measurements in i th subgroup. If ni=1, then the subgroup mean reduces to the single observation in the subgroup.
\overline{\overline{X}}weighted average of subgroup means
\Phi^{-1}(\cdot)inverse standard normal function

Plotted Points

Each point on the chart indicates the value of the uniformly weighted moving average for that subgroup. The moving average for the i th subgroup (Ai) is defined as
A_{i}=(\overline{X}_{1}+ ... +\overline{X}_{i})/i
 \;\;\;\;\;\;\;\;\;\;\;\; {\rm if } \; i\lt w

A_{i}=(\overline{X}_{i}+ ... +\overline{X}_{i-w+1})/w
 \;\;\; {\rm if } \; i\geq w

where w is the span, or number of terms, of the moving average. You can specify the span with the SPAN= option in the MACHART statement or with the value of _SPAN_ in a LIMITS= data set.

Central Line

By default, the central line on a moving average chart indicates an estimate for \mu, which is computed as
\hat{\mu}=\overline{\overline{X}} = \frac{n_{1}\bar{X_{1}} +  ...  + n_{N}\bar{X_{N}}}
 {n_{1} +  ...  + n_{N}}
If you specify a known value (\mu_{0}) for \mu,the central line indicates the value of \mu_{0}.

Control Limits

You can compute the limits in the following ways:

The following table presents the formulas for the limits:

Table 21.19: Limits for Moving Average Chart
Control Limits
LCL = \overline{\overline{X}}-k(\hat{\sigma}/\min(i,w)) \sqrt{ (1/n_{i}) +
 (1/n_{i-1}) + ... +(1/n_{1+\max(i-w,0)}) }
UCL = \overline{\overline{X}}+k(\hat{\sigma}/\min(i,w)) \sqrt{ (1/n_{i}) +
 (1/n_{i-1}) + ... +(1/n_{1+\max(i-w,0)}) }

Probability Limits
LCL = \overline{\overline{X}}-\Phi^{-1}(1-\alpha /2)(\hat{\sigma}/\min(i,w)) \sqrt{ (1/n_{i}) +
 (1/n_{i-1}) + ... +(1/n_{1+\max(i-w,0)}) }
UCL = \overline{\overline{X}}+\Phi^{-1}(1-\alpha /2)(\hat{\sigma}/\min(i,w)) \sqrt{ (1/n_{i}) +
 (1/n_{i-1}) + ... +(1/n_{1+\max(i-w,0)}) }

These formulas assume that the data are normally distributed. If standard values \mu_{0} and \sigma_{0} are available for \mu and \sigma, respectively, replace \overline{\overline{X}} with \mu_{0} and replace \hat{\sigma} with \sigma_{0} in Table 21.19. Note that the limits vary with both ni and i.

If the subgroup sample sizes are constant (ni=n), the formulas for the control limits simplify to

{\rm LCL}&=&\overline{\overline{X}}-\frac{k\hat{\sigma}}{\sqrt{n\min(i,w) } } \ {\rm UCL}&=&\overline{\overline{X}}+\frac{k\hat{\sigma}}{\sqrt{n\min(i,w) } }

Refer to Montgomery (1996) for more details. When the subgroup sample sizes are constant, the width of the control limits for the first w moving averages decreases monotonically because each of the first w moving averages includes one more term than the preceding moving average.

If you specify the ASYMPTOTIC option, constant control limits with the following values are displayed:

{\rm LCL}&=&\overline{\overline{X}}-\frac{k\hat{\sigma}}{\sqrt{nw} } \ {\rm UCL}&=&\overline{\overline{X}}+\frac{k\hat{\sigma}}{\sqrt{nw} }

For asymptotic probability limits, replace k with \Phi^{-1}(1-\alpha/2)in these equations. You can display asymptotic limits by specifying the ASYMPTOTIC option.

You can specify parameters for the moving average limits as follows:


Choosing the Span of the Moving Average

There are few published guidelines for choosing the span w. In some applications, practical experience may dictate the choice of w. A more systematic approach is to choose w by considering its effect on the average run length (the expected number of points plotted before a shift is detected). This effect was studied by Roberts (1959), who used simulation methods.

You can use Table 21.20 and Table 21.21 to find a combination of k and w that yields a desired ARL for an in-control process (\delta=0) and for a specified shift of \delta.

Table 21.20: Average Run Lengths for One-Sided Uniformly Weighted Moving Average Charts
  w (span)
k\delta23456810
         
2.00.0051.5860.9770.5880.1889.78108.65127.47
2.00.2525.0126.4728.0029.3330.7633.0835.18
2.00.5013.4113.3113.4013.6914.0114.6615.17
2.00.758.007.757.787.978.158.609.06
2.01.005.275.205.295.455.676.156.69
2.01.502.903.033.243.503.734.234.66
2.02.002.042.272.512.732.953.323.65
2.02.501.681.912.112.312.482.783.04
2.03.001.461.681.852.012.162.402.63
2.04.001.201.381.521.641.751.942.10
2.05.001.061.181.311.411.501.651.79
         
2.50.00179.92204.43230.32259.32287.08339.71394.43
2.50.2572.6271.5672.4872.9373.4075.5477.47
2.50.5033.6730.1328.5427.4926.9326.2926.03
2.50.7517.2815.0113.9113.4213.1313.0013.10
2.51.009.948.668.208.017.968.248.63
2.51.504.434.134.214.394.645.175.69
2.52.002.652.773.033.293.544.014.43
2.52.501.982.242.502.742.953.323.67
2.53.001.701.952.172.372.552.863.14
2.54.001.371.591.761.902.032.282.49
2.55.001.151.351.511.621.731.922.08
         
3.00.00792.24867.57963.951051.771150.791345.961539.75
3.00.25269.28244.26231.50226.25220.89209.87204.74
3.00.50104.1883.8672.8465.4360.8554.6250.34
3.00.7545.6934.4528.7925.6923.6621.2420.15
3.01.0022.7316.7414.2012.8912.1211.5211.45
3.01.507.656.165.705.645.756.236.78
3.02.003.773.493.633.894.174.715.20
3.02.502.462.632.903.183.433.884.28
3.03.001.962.232.502.742.953.333.65
3.04.001.571.812.002.182.342.622.87
3.05.001.301.551.721.851.972.202.40
         
3.50.004275.154536.994853.635168.755485.976088.036613.01
3.50.251281.121078.59964.86886.26830.03751.66684.98
3.50.50413.30294.47235.00197.27169.50136.01115.48
3.50.75153.5098.3173.4959.2950.4940.4534.53
3.51.0063.6839.3429.3724.0620.8817.7016.12
3.51.5015.8410.448.507.787.477.517.97
3.52.006.064.734.494.614.865.436.01
3.52.503.273.133.343.633.924.454.91
3.53.002.312.542.833.113.363.804.19
3.54.001.772.022.252.452.642.973.27
3.55.001.481.741.912.062.212.482.71

Table 21.21: Average Run Lengths for Two-Sided Uniformly Weighted Moving Average Charts

  w (span)
k\delta23456810
         
2.00.0025.4629.6233.9438.0842.3551.2059.48
2.00.2520.4322.3824.2125.8727.3530.0832.33
2.00.5012.7312.8013.0213.2913.5714.1914.84
2.00.757.877.687.717.868.038.448.90
2.01.005.245.145.225.405.596.096.60
2.01.502.903.023.243.483.714.194.63
2.02.002.042.262.512.732.943.313.63
2.02.501.671.912.122.302.472.773.03
2.03.001.461.671.852.012.152.402.63
2.04.001.201.381.521.641.751.942.10
2.05.001.061.191.311.411.501.651.79
         
2.50.0089.48101.24114.35127.74140.88166.98192.93
2.50.2563.1264.9167.0068.7569.8472.2274.49
2.50.5032.4629.5428.2027.3326.7225.9225.72
2.50.7517.2814.9713.8513.2913.0212.8112.98
2.51.009.948.618.167.998.018.238.63
2.51.504.424.144.204.384.625.165.67
2.52.002.652.773.033.293.544.004.43
2.52.501.992.242.502.732.953.333.65
2.53.001.691.952.172.372.542.863.14
2.54.001.371.591.761.902.042.272.49
2.55.001.151.351.511.631.731.922.09
         
3.00.00397.12436.27481.16527.14574.05667.68762.89
3.00.25245.51228.67222.75216.07213.79207.03201.71
3.00.50103.1583.4972.4765.6760.6753.9350.30
3.00.7545.5634.2529.0125.7223.5921.1219.93
3.01.0022.6816.8114.1912.9212.1811.5411.48
3.01.507.686.145.715.655.776.236.77
3.02.003.743.493.633.884.174.715.21
3.02.502.462.632.903.183.433.894.29
3.03.001.962.232.502.732.953.323.66
3.04.001.571.812.002.182.342.622.88
3.05.001.301.551.721.851.972.202.40
         
3.50.002217.612372.092567.272775.062983.703398.083810.50
3.50.251186.271027.67940.30875.91826.53744.59676.61
3.50.50411.69295.62232.68195.65169.21135.73116.06
3.50.75152.5297.3372.3058.9850.5940.2234.71
3.51.0064.0339.4629.1824.0820.8017.5416.16
3.51.5015.8310.368.477.737.467.568.00
3.52.006.054.714.494.614.855.446.00
3.52.503.273.123.343.643.924.444.91
3.53.002.322.542.833.113.363.804.19
3.54.001.772.022.252.462.652.973.26
3.55.001.491.741.912.062.212.482.71

For example, suppose you want to construct a two-sided moving average chart with an in-control ARL of 100 and an ARL of 9 for detecting a shift of \delta=1. Table 21.21 shows that the combination w=3 and k=2.5 yields an in-control ARL of 101.24 and an ARL of 8.61 for \delta=1.

Note that you can also use Table 21.20 and Table 21.21 to evaluate an existing moving average chart (see Example 21.2).

The following SAS program computes the average run length for a two-sided moving average chart for various shifts in the mean. This program can be adapted to compute averages run lengths for various combinations of k and w.


   data sim;
      drop span delta time j y x;
      span=4;
      do shift=0,.25,.5,.75,1,1.5,2,2.5,3,4,5;
         do j=1 to 50000;
            do time=1 to 15000;
               if time<=100 then
                  delta=0;
               else
                  delta=shift;
               y=delta+rannor(234);
               if time<span then
                  x=.;
               else
                  x=(y+lag1(y)+lag2(y)+lag3(y))/span;
               if time>=101 and abs(x)>3/sqrt(span)
                 then leave;
               end;
            arl=time-100;
            output;
            end;
         end;

   proc means;
      class shift;
   run;

In the preceding program, the size of the span w (SPAN) is 4 and the shifts in the mean are introduced to the variable (Y) y\sim N(0,1) after the first 100 observations. The first DO loop specifies shifts of various magnitude, the second DO loop performs 50000 simulations for each shift, and the third DO loop counts the run length (TIME), that is, the number of samples observed before the control chart signals. A large upper bound (15000) for TIME is specified so that the run length is uncensored.

The program can be generalized for various span sizes by assigning a different value for the variable SPAN and changing the expression for X appropriately. Optionally, you can compute the ARL for a one-sided chart by changing the limits, that is, x>3/sqrt(span). This was the technique used to construct Table 21.20 and Table 21.21.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.