Chapter Contents Previous Next
 The AUTOREG Procedure

## Example 8.3: Lack of Fit Study

Many time series exhibit high positive autocorrelation, having the smooth appearance of a random walk. This behavior can be explained by the partial adjustment and adaptive expectation hypotheses.

Short-term forecasting applications often use autoregressive models because these models absorb the behavior of this kind of data. In the case of a first-order AR process where the autoregressive parameter is exactly 1 (a random walk), the best prediction of the future is the immediate past.

PROC AUTOREG can often greatly improve the fit of models, not only by adding additional parameters but also by capturing the random walk tendencies. Thus, PROC AUTOREG can be expected to provide good short-term forecast predictions.

However, good forecasts do not necessarily mean that your structural model contributes anything worthwhile to the fit. In the following example, random noise is fit to part of a sine wave. Notice that the structural model does not fit at all, but the autoregressive process does quite well and is very nearly a first difference (A(1) = -.976).

```
title1 'Lack of Fit Study';
title2 'Fitting White Noise Plus Autoregressive Errors to a Sine Wave';

data a;
pi=3.14159;
do time = 1 to 75;
if time > 75 then y = .;
else y = sin( pi * ( time / 50 ) );
x = ranuni( 1234567 );
output;
end;
run;

proc autoreg data=a;
model y = x / nlag=1;
output out=b p=pred pm=xbeta;
run;

proc gplot data=b;
plot y*time=1 pred*time=2 xbeta*time=3 / overlay;
symbol1  v='none' i=spline;
symbol2  v=triangle;
symbol3  v=circle;
run;
```

The printed output produced by PROC AUTOREG is shown in Output 8.3.1 and Output 8.3.2. Plots of observed and predicted values are shown in Output 8.3.3.

Output 8.3.1: Results of OLS Analysis: No Autoregressive Model Fit

 Lack of Fit Study Fitting White Noise Plus Autoregressive Errors to a Sine Wave

 The AUTOREG Procedure

 Dependent Variable y

 Ordinary Least Squares Estimates SSE 34.8061005 DFE 73 MSE 0.47680 Root MSE 0.69050 SBC 163.898598 AIC 159.263622 Regress R-Square 0.0008 Total R-Square 0.0008 Durbin-Watson 0.0057

 Variable DF Estimate Standard Error t Value ApproxPr > |t| Intercept 1 0.2383 0.1584 1.50 0.1367 x 1 -0.0665 0.2771 -0.24 0.8109

 Estimates of Autocorrelations Lag Covariance Correlation `-1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 ` 0 0.4641 1.000000 `| |********************|` 1 0.4531 0.976386 `| |********************|`

 Preliminary MSE 0.0217

Output 8.3.2: Regression Results with AR(1) Error Correction

 Lack of Fit Study Fitting White Noise Plus Autoregressive Errors to a Sine Wave

 The AUTOREG Procedure

 Estimates of Autoregressive Parameters Lag Coefficient Standard Error t Value 1 -0.976386 0.025460 -38.35

 Yule-Walker Estimates SSE 0.18304264 DFE 72 MSE 0.00254 Root MSE 0.05042 SBC -222.30643 AIC -229.2589 Regress R-Square 0.0001 Total R-Square 0.9947 Durbin-Watson 0.0942

 Variable DF Estimate Standard Error t Value ApproxPr > |t| Intercept 1 -0.1473 0.1702 -0.87 0.3898 x 1 -0.001219 0.0141 -0.09 0.9315

Output 8.3.3: Plot of Autoregressive Prediction

 Chapter Contents Previous Next Top