Autocorrelation: Detection Tests

ECON 3209 · Week 18, Lecture 2 · Kerala Agricultural University

Department of Development Economics, KAU

Autumn 2026

Learning Outcomes

By the end of this lecture, you should be able to:

  1. compute and interpret the Durbin-Watson statistic
  2. understand the logic of the Breusch-Godfrey LM test
  3. compare when DW and BG are appropriate
  4. implement both tests in Python using statsmodels
  5. use test results to guide the next modelling step

How Do We Detect Autocorrelation?

  • Start with residual plots over time.
  • Check residual autocorrelation numerically.
  • Then use formal tests.
  • Two classics are:
    1. the Durbin-Watson (DW) statistic,
    2. the Breusch-Godfrey (BG) LM test.

Durbin-Watson Statistic

\[DW = \frac{\sum_{t=2}^T(\hat{e}_t - \hat{e}_{t-1})^2}{\sum_{t=1}^T \hat{e}_t^2} \approx 2(1-\hat{\rho})\]

  • DW near 2 suggests little first-order autocorrelation.
  • DW below 2 suggests positive autocorrelation.
  • DW above 2 suggests negative autocorrelation.
  • The test is mainly designed for AR(1)-type residual correlation.

Breusch-Godfrey LM Test

  • BG regresses residuals on original regressors and lagged residuals.
  • Null hypothesis: no serial correlation up to the chosen lag order.
  • BG is more flexible than DW because it can test higher-order autocorrelation.
  • It also works better when lagged dependent variables appear in the original model.

Compute DW in Python

Compute BG in Python

Reading the Output

  • For DW, compare the value with 2 as a quick rule of thumb.
  • For BG, use the LM statistic or F-statistic p-value.
  • A small p-value means rejecting the null of no serial correlation.
  • Rejection tells us we should not trust ordinary OLS standard errors.

Kerala Price Example

Suppose we regress Kerala monthly rubber prices on rainfall, export demand, and a time trend.

If market shocks carry over from one month to the next, both DW and BG may indicate positive residual serial correlation.

Residual Plot over Time

White Noise Comparison

DW versus BG

  • Use DW for a quick first check of first-order residual autocorrelation.
  • Use BG when you want more flexibility or suspect higher-order serial correlation.
  • In applied work, it is common to report both a residual plot and a formal test.

Exercise

Run DW and BG on the starter regression. Then state whether the residuals look positively autocorrelated and which test you would emphasise in a written report.

Summary

  • ✅ Durbin-Watson is a quick diagnostic for first-order autocorrelation.
  • ✅ Breusch-Godfrey is more flexible and can test serial correlation at higher lags.
  • ✅ Residual plots help translate the statistics into visible time patterns.
  • ✅ Once autocorrelation is detected, we need either corrected inference or a transformed model.

Next Lecture

  • We correct autocorrelation using Cochrane-Orcutt, Prais-Winsten ideas, and HAC robust standard errors.
  • You will see a full Python workflow from detection to correction.
  • This completes the autocorrelation unit before we begin time-series basics.