Open soominoh1 opened 4 years ago
Well I am going to fix the thing that gives the error seen here, but that unfortunately does not get us plotted predictions. As best as I can tell, the predict.plm()
function is rather half-baked and people are consistently getting errors trying to use it with within models. Two other packages that do similar things to this one, prediction
and ggeffects
, report the same issues and neither have resolved the problem.
Going to paste some links here in case I (or someone else) decide to revisit: https://github.com/leeper/prediction/issues/19 https://github.com/strengejacke/ggeffects/issues/121 https://stackoverflow.com/questions/31954045/r-plotting-panel-model-predictions-using-plm-pglm https://stackoverflow.com/questions/64892622/plotting-interaction-terms-from-fixed-effects-models-plm https://stackoverflow.com/questions/71366468/predict-on-test-data-using-plm-package-in-r-and-calculate-rmse-for-test-data
I suspect the solution here is to define a prediction function for plm
models within jtools
, but that's not something I'm willing to do right now. I don't understand plm
(or the generation of model predictions in general) well enough to be confident that I would produce accurate outputs.
There is now support for predict
for plm's within models in the development version available here: https://github.com/ycroissant/plm
As the within case is special, one likely wants to input a pdata.frame and not a plain data frame; the help page ?predict.plm
has the details.
Thank you @tappek for letting me know! I'll give some thought to the best way to implement.
For models produced by plm::plm()
, there is a predict
method available since plm
CRAN release version 2.6-2.
Hello. I'm trying to plot the interaction of a plm output, but it keeps giving me the following error. I've tried uninstalling and reinstalling R and the packages therein, but to no avail. I googled the error and there seems to be another person who has the same issue (StackOverflow post). Would you be so kind as to help figure out what is happening? Your help is much appreciated. Thank you!
Model run & error: