Hello.
Correct, IMHO: Achim's suggestion is the best way to get in-sample fitted 
values, w.r.t. e.g. direct calculation as yhat=X%*%coef, as it implicitly takes 
care of fixed effects etc..
A method for out-of-sample use is not implemented yet. It will eventually be, 
but there is no "schedule" for now. There are peculiar design issues: one for 
all, double dimensionality (prediction on the N dimension is meaningless for FE 
models etc. etc.).

Best,
Giovanni

-----Original Message-----
From: Achim Zeileis [mailto:achim.zeil...@uibk.ac.at]
Sent: Wed 20/10/2010 17.16
To: max.e.br...@gmail.com
Cc: r-h...@stat.math.ethz.ch; yves.croiss...@univ-reunion.fr; Millo Giovanni
Subject: Re: [R] fitted from plm
 
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.
>


 
Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:15}}

______________________________________________
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