Autocorrelation in Process Data
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: SHWARIEW */
/* TITLE: Autocorrelation in Process Data */
/* PRODUCT: QC */
/* SYSTEM: ALL */
/* KEYS: Shewhart Charts, Autocorrelation, */
/* PROCS: SHEWHART ARIMA */
/* DATA: */
/* */
/* REF: SAS/QC Software: Usage and Reference, Version 6, */
/* First Edition, Volume 1 and Volume 2 */
/* */
/****************************************************************/
data Chemical;
input xt @@;
t = _n_;
datalines;
96 90 89 89 94 91 89 93 87 85
84 84 87 90 88 92 91 93 91 92
85 88 89 89 92 91 85 86 89 88
88 91 95 101 92 97 92 89 90 84
82 86 87 82 82 87 86 86 81 89
91 92 99 91 90 84 79 76 77 74
78 83 81 86 84 79 76 81 78 78
81 78 78 82 81 81 83 80 78 73
71 74 73 68 70 72 70 68 72 81
91 82 85 80 80 81 83 83 86 88
;
symbol h=2.0 pct;
title 'Individual Measurements Chart';
proc shewhart data=Chemical;
irchart xt*t / npanelpos = 100
split = '/';
label xt = 'Observed/Moving Range'
t = 'Time';
run;
ods graphics on;
ods select ChiSqAuto SeriesACFPlot SeriesPACFPlot;
proc arima data=Chemical plots(only)=series(acf pacf);
identify var = xt;
run;
quit;
ods select ParameterEstimates;
proc arima data=Chemical;
identify var=xt;
estimate p=1 method=ml;
run;
proc arima data=Chemical;
identify var=xt;
estimate p=1 method=ml;
forecast out=Results id=t;
run;
title 'Residual Analysis Using AR(1) Model';
symbol h=2.0 pct;
proc shewhart data=Results(firstobs=4 obs=100);
xchart xt*t / npanelpos = 100
split = '/'
trendvar = forecast
xsymbol = xbar
ypct1 = 40
vref2 = 70 to 100 by 10
lvref = 2
nolegend;
label xt = 'Residual/Forecast'
t = 'Time';
run;
title ;
proc arima data=Chemical;
identify var=xt(1);
estimate q=1 method=ml noint;
forecast out=EWMA id=t;
run;
data EWMA;
set EWMA(firstobs=2 obs=100);
run;
data EWMAtab;
length _var_ $ 8 ;
set EWMA (rename=(forecast=_mean_ xt=_subx_));
_var_ = 'xt';
_sigmas_ = 3;
_limitn_ = 1;
_lclx_ = _mean_ - 3 * std;
_uclx_ = _mean_ + 3 * std;
_subn_ = 1;
run;
symbol h=2.0 pct;
title 'EWMA Center Line Control Chart';
proc shewhart table=EWMAtab;
xchart xt*t / npanelpos = 100
xsymbol = 'Center'
nolegend;
label _subx_ = 'Observed'
t = 'Time' ;
run;