On Wed, 20 Oct 2010, max.e.br...@gmail.com wrote:

Hi,

I am estimating a (fixed-effects) model with plm, for which I would like
to get the fitted values. If I call fitted() on my estimated model, it
returns NULL.

How do I get the fitted values out of the plm object?

I think there is currently no method for that. In many cases, you can compute them fairly easily from the residuals via

  y - residuals(...)

And if the model frame is retained you find y in the $model element. Hence, a dirty hack that should work is

  fitted.panelmodel <- function(object, ...)
    object$model[[1]] - object$residuals

However, beware of models where the number of observations might be reduced due to lags and differencing.

And of course this covers just in-sample predictions. The out-of-sample case would have to be done by hand.

Yves and Giovanni (cc) might be able to provide more/better/correct information...

Best,
Z

Thanks.

Max

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to