Previous Page | Next Page

The AUTOREG Procedure

Testing for Autocorrelation

In the preceding section, it is assumed that the order of the autoregressive process is known. In practice, you need to test for the presence of autocorrelation.

The Durbin-Watson test is a widely used method of testing for autocorrelation. The first-order Durbin-Watson statistic is printed by default. This statistic can be used to test for first-order autocorrelation. Use the DWPROB option to print the significance level (p-values) for the Durbin-Watson tests. (Since the Durbin-Watson p-values are computationally expensive, they are not reported by default.)

You can use the DW= option to request higher-order Durbin-Watson statistics. Since the ordinary Durbin-Watson statistic tests only for first-order autocorrelation, the Durbin-Watson statistics for higher-order autocorrelation are called generalized Durbin-Watson statistics.

The following statements perform the Durbin-Watson test for autocorrelation in the OLS residuals for orders 1 through 4. The DWPROB option prints the marginal significance levels (p-values) for the Durbin-Watson statistics.

   /*-- Durbin-Watson test for autocorrelation --*/
   proc autoreg data=a;
      model y = time / dw=4 dwprob;
   run;

The AUTOREG procedure output is shown in Figure 8.7. In this case, the first-order Durbin-Watson test is highly significant, with p < .0001 for the hypothesis of no first-order autocorrelation. Thus, autocorrelation correction is needed.

Figure 8.7 Durbin-Watson Test Results for OLS Residuals
Forecasting Autocorrelated Time Series

The AUTOREG Procedure

Dependent Variable y

Forecasting Autocorrelated Time Series

The AUTOREG Procedure

Ordinary Least Squares Estimates
SSE 214.953429 DFE 34
MSE 6.32216 Root MSE 2.51439
SBC 173.659101 AIC 170.492063
MAE 2.01903356 AICC 170.855699
MAPE 12.5270666 Regress R-Square 0.8200
    Total R-Square 0.8200

Durbin-Watson Statistics
Order DW Pr < DW Pr > DW
1 0.4752 <.0001 1.0000
2 1.2935 0.0137 0.9863
3 2.0694 0.6545 0.3455
4 2.5544 0.9818 0.0182

Note: Pr<DW is the p-value for testing positive autocorrelation, and Pr>DW is the p-value for testing negative autocorrelation.


Variable DF Estimate Standard Error t Value Approx
Pr > |t|
Intercept 1 8.2308 0.8559 9.62 <.0001
time 1 0.5021 0.0403 12.45 <.0001

Using the Durbin-Watson test, you can decide if autocorrelation correction is needed. However, generalized Durbin-Watson tests should not be used to decide on the autoregressive order. The higher-order tests assume the absence of lower-order autocorrelation. If the ordinary Durbin-Watson test indicates no first-order autocorrelation, you can use the second-order test to check for second-order autocorrelation. Once autocorrelation is detected, further tests at higher orders are not appropriate. In Figure 8.7, since the first-order Durbin-Watson test is significant, the order 2, 3, and 4 tests can be ignored.

When using Durbin-Watson tests to check for autocorrelation, you should specify an order at least as large as the order of any potential seasonality, since seasonality produces autocorrelation at the seasonal lag. For example, for quarterly data use DW=4, and for monthly data use DW=12.

Lagged Dependent Variables

The Durbin-Watson tests are not valid when the lagged dependent variable is used in the regression model. In this case, the Durbin h test or Durbin t test can be used to test for first-order autocorrelation.

For the Durbin h test, specify the name of the lagged dependent variable in the LAGDEP= option. For the Durbin t test, specify the LAGDEP option without giving the name of the lagged dependent variable.

For example, the following statements add the variable YLAG to the data set A and regress Y on YLAG instead of TIME:

   data b;
      set a;
      ylag = lag1( y );
   run;
   
   proc autoreg data=b;
      model y = ylag / lagdep=ylag;
   run;

The results are shown in Figure 8.8. The Durbin h statistic 2.78 is significant with a p-value of 0.0027, indicating autocorrelation.

Figure 8.8 Durbin h Test with a Lagged Dependent Variable
Forecasting Autocorrelated Time Series

The AUTOREG Procedure

Dependent Variable y

Forecasting Autocorrelated Time Series

The AUTOREG Procedure

Ordinary Least Squares Estimates
SSE 97.711226 DFE 33
MSE 2.96095 Root MSE 1.72074
SBC 142.369787 AIC 139.259091
MAE 1.29949385 AICC 139.634091
MAPE 8.1922836 Regress R-Square 0.9109
    Total R-Square 0.9109

Miscellaneous Statistics
Statistic Value Prob Label
Durbin h 2.7814 0.0027 Pr > h

Variable DF Estimate Standard Error t Value Approx
Pr > |t|
Intercept 1 1.5742 0.9300 1.69 0.0999
ylag 1 0.9376 0.0510 18.37 <.0001

Previous Page | Next Page | Top of Page