DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


Declaration: DurbinWatsonTest (Residuals: TDoubleArray): double;

The function DurbinWatson calculates the test statistic of the Durbin-Watson test for serial correlation of the residuals of a linear regression model. The serial data to be tested are contained in the open array Residuals. The returned test statistic can be checked against their critical limits by means of the function DurbinWatsonCrit5pct, which returns two limits ( dwLower and dwUpper).

The null hypothesis (there is no serial correlation) has to be rejected if the test statistic is less than dwLower, and must not be rejected if it is greater than dwUpper. If the test statistic is between dwLower and dwUpper, the Durbin-Watson test is inconclusive.

Hint: Please note that the Durbin-Watson statistic has a range between 0 and 4, with 0 indicating positive correlation, 4 indicating negative correlation and a value of 2 indicates no correlation. The critical limits calculated by DurbinWatsonCrit5pct always apply to positive correlations. As the distribution of the DW statistic is symmetric about 2 you have to calculate 4-DW if DW exceeds 2 before you compare the DW to the critical limits.