Reputation: 1069
I'm trying to obtain the Durban Watson statistic for a regression I'm running in R. However, when I run the code dw.test(x~y)
, R keeps telling me Error: could not find function "dw.test"
. I've checked and the dw.test function is part of the bstats package, which is a base package.
Does anyone have any idea why R is unable to recognise the dw.test function?
Thank you!
Mike
Upvotes: 1
Views: 8863
Reputation: 3158
The package ‘bstats’ is not available (for R version 3.0.2).
Try:
library(lmtest)
err1 <- rnorm(100)
x <- rep(c(-1,1), 50)
y1 <- 1 + x + err1
dwtest(y1 ~ x)
Upvotes: 2
Reputation: 2269
I think you have to import the function from outside of base R. Try
library(car)
dwt(lm(x ~ y))
or
durbinWatsonTest(lm(x ~ y))
Upvotes: 5