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
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
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)
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.