How to use the durbin-watson statistic calculator
- Choose Residuals if you already have regression residuals in time order, or x and y to fit a straight line first.
- Paste the values, separated by commas, spaces or new lines. For x and y, paste the same number of values in each box.
- Optionally enter the lower and upper critical values dL and dU from a Durbin-Watson table for your sample size.
- Read d, the estimated autocorrelation, the lag-1 autocorrelation of the residuals and, if you gave both critical values, a verdict.
Formula
d = sum of (e(t) - e(t-1))^2 for t = 2 to n, divided by sum of e(t)^2 for t = 1 to n
d runs from 0 to 4; for large samples d is close to 2 (1 - r), with r the lag-1 autocorrelation
Positive autocorrelation: d below dL; no evidence: d between dU and 4 - dU; negative: d above 4 - dL
Between dL and dU, and between 4 - dU and 4 - dL, the test is inconclusive
The critical values depend on the sample size and the number of predictors, so they come from your own table. The page does not include one.
Drifting, alternating and fitted residuals
Twelve residuals that drift slowly up and down, 0.5, 0.8, 1.1, 0.9, 0.4, -0.2, -0.7, -1.0, -0.8, -0.3, 0.3, 0.6, give d = 0.33045 and a lag-1 autocorrelation of 0.78201, a strong positive pattern. Ten residuals that alternate in sign, 1, -1.2, 0.9, -1.1 and so on, give d = 3.54072 and a lag-1 autocorrelation of -0.875.
For x = 1 to 15 and y values that rise by about 2 each step but wobble around the line, the fitted line is y = 0.0409524 + 2.00071 x and d = 3.53487. With a table entry of dL = 1.08 and dU = 1.36, d is above 4 - dL = 2.92, so there is evidence of negative autocorrelation.
Why autocorrelation matters
Ordinary regression assumes the errors are independent. When errors in time order are correlated, standard errors are misleading: positive correlation makes them too small and results look more certain than they are. The Durbin-Watson statistic is a quick check on the residuals of a fitted model, especially in time series such as monthly sales or prices.
To see the autocorrelation at every lag, use the autocorrelation calculator. To fit the line whose residuals you are testing, use the linear regression calculator. To turn a test statistic into a p value, use the p value calculator.
Reading d
A value near 2 means the residuals look unrelated from one step to the next. Values well below 2 mean that a positive residual tends to be followed by another positive one, and values well above 2 mean the signs tend to alternate. The approximate autocorrelation shown, 1 minus d / 2, gives a rough size of the effect.
The statistic checks only first-order autocorrelation, so it can miss patterns at longer lags, and it is not valid when the model includes a lagged copy of the response among its predictors. For residual spread, the standard deviation calculator is a useful companion.
Assumptions and limits
- The values are in time or sequence order.
- For x and y mode a straight line with an intercept is fitted by least squares.
- Critical values are entered by you and are not built in.
- Between 3 and 2000 values are accepted.
Frequently asked questions
What is the Durbin-Watson statistic?
A number between 0 and 4 that measures first-order autocorrelation in regression residuals. About 2 means none.
What counts as a bad value?
There is no single cut-off. Compare d with the critical values dL and dU for your sample size and number of predictors, or look at how far it is from 2.
Why does the page not include a table?
The critical values depend on the sample size, the number of predictors and the significance level, so you should take them from a table that matches your model.
Can I use it for data that is not in time order?
Only if the order is meaningful. The statistic depends on the order of the residuals, and a different order gives a different value.