[R] Durbin-Watson

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Fri Aug 7 11:26:54 CEST 2009


On Fri, 7 Aug 2009, Hardi wrote:

> Now I understand better how does the durbin watson test works. But this 
> means that my residuals are not independent (note that I'm doing this 
> test to validate the ANOVA assumption that the residuals are 
> independent).

Yes. The autocorrelation is rather low, though, so it might be hard to see 
in visualizations that you mention below.

> The results were taken from a simulation result and each run are 
> supposed to be independent to each other and I am grouping the data 
> based on design points. The plot from residuals vs fitted and residuals 
> vs time looks random enough although each groups has slightly different 
> variance.

I'm not sure that the Durbin-Watson test is appropriate at all for your 
data. This seems to be longitudinal or panel data, right? The standard 
Durbin-Watson test is for time series regressions.

(Snippiness alert: This might have become more clear if a textbook would 
have been consulted more thoroughly as suggested in my previous 
mail...even though other respondents seem to feel that you do not need to 
understand the test, or read its manual, to apply it.)

> Am I heading the correct way here, by testing the independence of the 
> whole residuals (which resulting the failure of independence test) or 
> should I test for the independence for each groups? (which resulting the 
> passing of the test).

Hard to say from your description, but it seems that one of the following 
might help: using some sandwich covariances (see package "sandwich") after 
a linear regression with lm() or using GEE (see package "geepack") with a 
suitable dependence structure.

hth,
Z




More information about the R-help mailing list