Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The AUTOREG Procedure

Forecasting Autoregressive Error Models

To produce forecasts for future periods, include observations for the forecast periods in the input data set. The forecast observations must provide values for the independent variables and have missing values for the response variable.

For the time trend model, the only regressor is time. The following statements add observations for time periods 37 through 46 to the data set A to produce an augmented data set B:


   data b;
      y = .;
      do time = 37 to 46; output; end;
   run;
   
   data b; merge a b; by time; run;

To produce the forecast, use the augmented data set as input to PROC AUTOREG, and specify the appropriate options in the OUTPUT statement. The following statements produce forecasts for the time trend with autoregressive error model. The output data set includes all the variables in the input data set, the forecast values (YHAT), the predicted trend (YTREND), and the upper (UCL) and lower (LCL) 95% confidence limits.


   proc autoreg data=b;
      model y = time / nlag=2 method=ml;
      output out=p p=yhat pm=ytrend
                   lcl=lcl ucl=ucl;
   run;

The following statements plot the predicted values and confidence limits, and they also plot the trend line for reference. The actual observations are shown for periods 16 through 36, and a reference line is drawn at the start of the out-of-sample forecasts.


   title "Forecasting Autocorrelated Time Series";
   proc gplot data=p;
      plot y*time=1 yhat*time=2 ytrend*time=3
           lcl*time=3 ucl*time=3 /
           overlay HREF=36.5;
      where time >= 16;
      symbol1 v=star i=none;
      symbol2 v=circle i=join;
      symbol3 v=none i=join;
   run;

The plot is shown in Figure 8.6. Notice that the forecasts take into account the recent departures from the trend but converge back to the trend line for longer forecast horizons.

autgs06.gif (4953 bytes)

Figure 8.6: PROC AUTOREG Forecasts

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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