Durbin-Watson Test
Hypothesis Testing
After performing a regression analysis, let’s assume we are given a residual $\left\{ e_{t} \right\}_{t=1}^{n}$ and express it as $e_{t} := \rho e_{t-1} + \nu_{t}$.
- $H_{0}$: $\rho = 0$ i.e., the residuals do not exhibit autocorrelation.
- $H_{1}$: $\rho \ne 0$ i.e., the residuals exhibit autocorrelation.
Explanation
Empirical Interpretation
The Durbin-Watson test is used to check the independence of residuals after regression analysis, determining whether or not the residuals have autocorrelation. The test statistic is calculated as $$ d := {{ \sum_{t=2}^{n} \left( e_{t} - e_{t-1} \right)^2 } \over {\sum_{t=1}^{n} e_{t}^{2} }} $$, and it always satisfies $0 \le d \le 4$. The value of $d$ is interpreted as follows:
- $d \approx 0$: The residuals have a positive correlation.
- $d \approx 2$: The residuals do not have any correlation.
- $d \approx 4$: The residuals have a negative correlation.
Of course, during the test, a significance level $\alpha$ is given, and lower $d_{L , \alpha}$ and upper $d_{U , \alpha}$ thresholds are computed for comparison.
Precautions
The Durbin-Watson test is more complicated to use than it seems, and the precautions are as follows:
- It only identifies the correlation between $e_{t}$ and $e_{t-1}$, not between $e_{t}$ and $e_{t-k}$. To check for multiple lags $k$, a generalized Durbin-Watson test should be used.
- Even if the residuals have autocorrelation, it doesn’t mean they are independent; lack of autocorrelation doesn’t imply independence. Absence of autocorrelation does not imply independence.
- Almost unnecessary. It’s not that the Durbin-Watson test is unreliable, but due to drawbacks like 1 and 2, even if accurate, it doesn’t help much in justifying the analysis.
- It cannot be applied to the residuals of an ARIMA model. Thus, autocorrelation functions or the Ljung-Box test should be used.
Despite these drawbacks, the test is still easy and manageable, so it continues to be introduced and used in many textbooks. To summarize the drawbacks, it’s like ‘you can use it, but don’t trust it too much.’ This is even more true for learners who are still new to statistics. It’s good to use, but one must understand its purposes and limits accurately. Passing the Durbin-Watson test alone cannot easily prove independence.
Code
Practice
In R, the dwtest()
function from the lmtest
package allows for a simple implementation of the Durbin-Watson test.
At first glance, the residuals appear independent, but testing as follows actually confirms the lack of autocorrelation.
Full Code
library(lmtest)
out<-lm(waiting~eruptions,data=faithful)
win.graph(6,3); plot(rstudent(out),main="residuals")
dwtest(out)