Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
MACHART Statement

Example 21.2: Annotating Average Run Lengths on the Chart

See MACMA3 in the SAS/QC Sample Library

You can use Table 21.20 and Table 21.21 to find a moving average chart scheme with the desired average run length properties. Specifically, you can 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.

You can also use these tables to evaluate an existing moving average chart scheme. For example, the moving average chart shown in Output 21.1.1 has a two-sided scheme with w=4 and k=3. Suppose you want to detect a shift of \delta=.5.From Table 21.21, the average run length with w=4, k=3, and \delta=.5 is 72.47. The in-control average run length (\delta=0) for this scheme is 481.16.

The following statements create an annotate data set that can be read to display these ARL values on the moving average chart:

   data arlanno;
      length function style color $ 8 text $ 20;
      function = 'label';    hsys = '1';  xsys = '1'; ysys = '1';
                             size     =  5;
                             position = 'c';
                             style    = 'swiss';
                             color    = 'black';
                             x        =  78;
                             y        =  92;
                             text     = 'ARL Evaluation'; output;
                             y        =  84;
                             text     = 'ARL In';         output;
                             y        =  78;
                             text     = 'ARL Out';        output;
                             position = 'a';
                             x        =  97;
                             y        =  84;
                             text     = '481.16';         output;
                             y        =  78;
                             text     = ' 72.47' ;        output;
      function = 'poly';     style    = 'empty';
                             x = 98;  y = 98;             output;
      function = 'polycont'; x = 98;  y = 77;             output;
                             x = 77;  y = 77;             output;
                             x = 77;  y = 98;             output;
                             x = 98;  y = 98;             output;
      function = 'move';     x = 77;  y = 91;             output;
      function = 'draw';     size  = 1;
                             hsys  = '4';
                             x = 98; y = 91;              output;
   run;

The following statements create the moving average chart shown in Output 21.2.1.

   title 'Moving Average Chart to Detect a Shift of 0.5';
   symbol v=dot c=yellow h=.8;
   proc macontrol data=clips1 annotate=arlanno;
      machart gap*day /
          mu0      = 15
          sigma0   = 0.2
          span     = 4
          xsymbol  = mu0
          haxis    = axis1
          vaxis    = axis2
          cframe   = steel
          cinfill  = vpab
          cconnect = yellow
          coutfill = salmon;
   axis1 offset=(2 pct, 2pct);
   axis2 offset=(2 pct, 2pct);
   run;
The average run lengths in this example (481.16 and 72.27) are simply copied from Table 21.21. You can generalize the preceding program so that it computes the average run lengths by incorporating the simulation program.

Output 21.2.1: Displaying Average Run Lengths on Chart
maex2.gif (5161 bytes)

For more information on ANNOTATE= data sets, refer to SAS/GRAPH Software: Reference.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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