2

I am having trouble running a Durbin Watson test on the prais winsten model I generated.

value3<-prais.winsten(value1$model)
dwtest(value3)

I receive this error:

Error in terms.default(formula) : no terms component nor attribute
GrandMasterFlush
  • 6,269
  • 19
  • 81
  • 104
Nick
  • 833
  • 2
  • 8
  • 11

2 Answers2

0

Without any reasonable reproducible example is hard to pinpoint where is the issue, this is a kind of default way to go:

# Calculate Durbin-Watson                                                                         
ols <- lm(y ~ x1 + x2)  

dwtest(y ~ x1 + x2)

prais.winsten.lm(ols)

# Calcuate Autocorrelation and Partial Autocorrelation Coefficients                 
acf(resid(ols),lag.max = 5,plot = FALSE)
pacf(resid(ols),lag.max = 5,plot = FALSE)
daniel
  • 1,186
  • 2
  • 12
  • 21
0

You need to call dtest with the lm function on the list that prais.winsten returns

From your example it would be:

dwtest(lm(value3[[1]]))

When you display value3 you should see somthing like this at the top

[[1]]

Call: lm(formula = fo)

This is what I am referring to.

Community
  • 1
  • 1
sigurdb
  • 1,335
  • 13
  • 13