plm: within model
Opened this issue · 5 comments
library(prediction)
library(plm)
example(plm)
pred1 <- prediction(wi)
# Error in crossprod(beta, t(X)) : non-conformable arguments
This is probably due to the within model having no intercept.
Please also note that predict()
on plm models gives you the fitted values of the (quasi-)demeaned model. My guess is, you want the fitted values of the "overall" model (likewise, residuals()
gives you the residuals of the (quasi-)demeaned model). There is an experimental, non-exported function plm:::fitted_exp.plm()
for that in the development version of plm.
To handle the default case (use data from model estimation), you could introduce a find_data.plm method that returns NULL as this circumvents the else-branch in predict.plm which seems to be buggy for within models.
Hello,
I'm having the same problem with the prediction on the plm within model. Please let me know if this is a bug in the package or if you have any suggestions for me.
Appreciate your help!
Thanks,
Jayashree
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.
For models produced by plm::plm()
, there is a predict
method available since plm
version 2.6-2.