Rhea M Pradeep
Rhea M Pradeep

Reputation: 9

How to find autocorrelation value using Durbin Watson Test?

How can I get autocorrelation value using Durbin Watson test? when durbin watson test was done using dwtest()I i got this as answer.

fit <- lm(eruptions ~ waiting, faithful.data)
dwtest(fit)
 >Durbin-Watson test
 +data:  fit
 +DW = 2.561, p-value = 1
 +alternative hypothesis: true autocorrelation is greater than 0

Upvotes: 1

Views: 300

Answers (1)

LyzandeR
LyzandeR

Reputation: 37879

Save the variable and then extract it. For example:

fit <- lm(mpg ~ cyl, mtcars)
dw <- dwtest(fit)
dw$statistic
#      DW 
#1.669691 

Upvotes: 2

Related Questions