|
Chapter Contents |
Previous |
Next |
| The AUTOREG Procedure |
In this example, a pure autoregressive error model with no regressors is used to generate 50 values of a time series. Approximately fifteen percent of the values are randomly chosen and set to missing. The following statements generate the data.
title 'Simulated Time Series with Roots:';
title2 ' (X-1.25)(X**4-1.25)';
title3 'With 15% Missing Values';
data ar;
do i=1 to 550;
e = rannor(12345);
n = sum( e, .8*n1, .8*n4, -.64*n5 ); /* ar process */
y = n;
if ranuni(12345) > .85 then y = .; /* 15% missing */
n5=n4; n4=n3; n3=n2; n2=n1; n1=n; /* set lags */
if i>500 then output;
end;
run;
The model is estimated using maximum likelihood, and the residuals are plotted with 99% confidence limits. The PARTIAL option prints the partial autocorrelations. The following statements fit the model:
proc autoreg data=ar partial;
model y = / nlag=(1 4 5) method=ml;
output out=a predicted=p residual=r ucl=u lcl=l alphacli=.01;
run;
The printed output produced by the AUTOREG procedure is shown in Output 8.4.1.
Output 8.4.1: Autocorrelation-Corrected Regression Results|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||
data reshape1;
set a;
miss = .;
if r=. then do;
miss = p;
p = .;
end;
run;
title 'Predicted Values and Confidence Limits';
proc gplot data=reshape1;
plot l*i=1 miss*i=2 p*i=3 u*i=4 / overlay;
symbol1 i=join v=none l=2;
symbol2 i=needle v='X';
symbol3 i=needle v=circle;
symbol4 i=join v=none l=2;
run;
The plot of the predicted values and the upper and lower confidence limits is shown in Output 8.4.2. Note that the confidence interval is wider at the beginning of the series (when there are no past noise values to use in the forecast equation) and after missing values where, again, there is an incomplete set of past residuals.
Output 8.4.2: Plot of Residuals and Confidence Interval
|
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.