I seem to misunderstand how the dwtest
of the lmtest package in R works.
> r1 <- runif(1000, 0.0, 1.0)
> r2 <- runif(1000, 0.0, 1.0)
> dwtest(lm(r2 ~ r1 ))
Durbin-Watson test
data: lm(r2 ~ r1)
DW = 1.9806, p-value = 0.3789
alternative hypothesis: true autocorrelation is greater than 0
>
> r1 <- seq(0, 1000, by=1)
> r2 <- seq(0, 1000, by=1)
> dwtest(lm(r2 ~ r1 ))
Durbin-Watson test
data: lm(r2 ~ r1)
DW = 2.2123, p-value = 0.8352
When i understand everything right, I first test 2 sets of random numbers with each other (which do not correlate - correct)
Then i correlate the numbers from 1 to 1000 incrementing with them self (which does not correlate - uhm... what)
Can someone point me to the obvious error i do?