Andra
Andra

Reputation: 1

Error: could not find function "pdwtest"

I applied the DW test to my pooled model in R and I get this error

Error: could not find function "pdwtest"

What's wrong? I installed the package lmtest.

Upvotes: 0

Views: 701

Answers (1)

RHertel
RHertel

Reputation: 23788

You are looking at the wrong library. The function pdwtest() is part of the plm package, and not of lmtest. Try this:

install.packages("plm")
library(plm)
data("Grunfeld", package = "plm")
pdwtest(inv ~ value + capital, data=Grunfeld, model="random")
#
#   Durbin-Watson test for serial correlation in panel models
#
#data:  inv ~ value + capital
#DW = 0.99636, p-value = 2.819e-13
#alternative hypothesis: serial correlation in idiosyncratic errors

Upvotes: 2

Related Questions