[R] Durbin-Watson
Hardi
sky_drake at yahoo.com
Fri Aug 7 10:37:05 CEST 2009
Thank you for all your reply, especially Alan
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).
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.
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).
Thank you very much,
~ Hardi
----- Original Message ----
From: Alan Cohen <CohenA at smh.toronto.on.ca>
To: sky_drake at yahoo.com
Sent: Thursday, August 6, 2009 9:38:19 PM
Subject: Durbin-Watson
Hi Hardi,
I saw the first reply you got to your question, which was correct but snippy and a bit over-technical. To say it more clearly (and nicely - appreciating that you will not become a statistical guru of every test you ever use), you have performed a two-tailed test with durbin.watson() and a one-tailed test with dwtest(), so the p-value for the former should be approximately twice that for the latter. Your one-tailed test was performed in the wrong direction - your autocorrelation is negative, but you were testing for a positive association.
1-p = 1-0.9964 = 0.0036. This is still not exactly the same as 0.018/2=0.0059, but the ranges are similar, and if you need to figure it out in more depth I'd refer back to the first response, which points out the differences in calculation methods.
If you want to control the direction of the test in dwtest, use the "alternative" option, copied from the ?dwtest help file below:
dwtest(formula, order.by = NULL, alternative = c("greater", "two.sided", "less"),
iterations = 15, exact = NULL, tol = 1e-10, data = list())
alternative - a character string specifying the alternative hypothesis.
Cheers,
Alan Cohen
More information about the R-help
mailing list