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. 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: Durbin-Watson Test Results for OLS Residuals

Forecasting Autocorrelated Time Series

The AUTOREG Procedure

Dependent Variabley

Ordinary Least Squares Estimates
SSE214.953429DFE34
MSE6.32216Root MSE2.51439
SBC173.659101AIC170.492063
MAE2.01903356AICC170.855699
MAPE12.5270666HQC171.597444
  Total R-Square0.8200

Durbin-Watson Statistics
OrderDWPr < DWPr > DW
10.4752<.00011.0000
21.29350.01370.9863
32.06940.65450.3455
42.55440.98180.0182

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


Parameter Estimates
VariableDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Intercept18.23080.85599.62<.0001
time10.50210.040312.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, 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 9. The Durbin h statistic 2.78 is significant with a p-value of 0.0027, indicating autocorrelation.

Figure 9: Durbin h Test with a Lagged Dependent Variable

Forecasting Autocorrelated Time Series

The AUTOREG Procedure

Dependent Variabley

Ordinary Least Squares Estimates
SSE97.711226DFE33
MSE2.96095Root MSE1.72074
SBC142.369787AIC139.259091
MAE1.29949385AICC139.634091
MAPE8.1922836HQC140.332903
  Total R-Square0.9109

Miscellaneous Statistics
StatisticValueProbLabel
Durbin h2.78140.0027Pr > h

Parameter Estimates
VariableDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Intercept11.57420.93001.690.0999
ylag10.93760.051018.37<.0001


Last updated: June 19, 2025