You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
change the way lag variables are detected in predict #38
Hi, I have this issue when using predict on a Durbin model with only some lagged variables. Assuming the problem isn't easy to fix, would there be any other way to generate forecasts with a model like this? Thanks.
So after looking at it more carefully, I believe my error was actually being caused by a mismatch of structure between my original dataset and the predicting dataset. The message I had was:
"Error in predict.Sarlm(mod, dfp, listw = weights) :
unknown mismatch. please report this bug
In addition: Warning message:
In colnames(Xs.not.lagged) != colnames(Xo) :
longer object length is not a multiple of shorter object length"
I assumed the first error (which in the code you link to this issue) was the main problem but fixing the second warning appears to have made everything work. An example of what I'm doing:
I think this works fine. But just to be clear, predict is aware that only CRIM is a spatially lagged variable in the model, as specified in lagsarlm, right? I think I may have misunderstood this issue.
Activity
dpr01 commentedon Mar 6, 2024
Hi, I have this issue when using
predicton a Durbin model with only some lagged variables. Assuming the problem isn't easy to fix, would there be any other way to generate forecasts with a model like this? Thanks.rsbivand commentedon Mar 7, 2024
Could you provide a reproducible example that matches your case?
dpr01 commentedon Mar 7, 2024
So after looking at it more carefully, I believe my error was actually being caused by a mismatch of structure between my original dataset and the predicting dataset. The message I had was:
"Error in predict.Sarlm(mod, dfp, listw = weights) :
unknown mismatch. please report this bug
In addition: Warning message:
In colnames(Xs.not.lagged) != colnames(Xo) :
longer object length is not a multiple of shorter object length"
I assumed the first error (which in the code you link to this issue) was the main problem but fixing the second warning appears to have made everything work. An example of what I'm doing:
I think this works fine. But just to be clear,
predictis aware that onlyCRIMis a spatially lagged variable in the model, as specified inlagsarlm, right? I think I may have misunderstood this issue.rsbivand commentedon Mar 7, 2024
Yes,
predictonly useslag.CRIM, not other lagged X variables.