xtable for plm objects

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

xtable for plm objects

Stephen J. Barr-2
Hello,

I am trying to use Sweave to write up a report, and I have used the
plm package to do some panel models. I am trying to use xtable to make
a nice table for my regression objects (returned by the plm command),
but I am getting the error:
Error in UseMethod("xtable") : no applicable method for "xtable"

It seems like I would want to have xtable treat plm objects exactly as
lm objects. Is there a way I can force this behavior?

Thanks,
-stephen
==========================================
Stephen J. Barr
University of Washington
WEB: www.econsteve.com

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: xtable for plm objects

Achim Zeileis
On Fri, 12 Jun 2009, Stephen J. Barr wrote:

> Hello,
>
> I am trying to use Sweave to write up a report, and I have used the
> plm package to do some panel models. I am trying to use xtable to make
> a nice table for my regression objects (returned by the plm command),
> but I am getting the error:
> Error in UseMethod("xtable") : no applicable method for "xtable"
>
> It seems like I would want to have xtable treat plm objects exactly as
> lm objects. Is there a way I can force this behavior?

I quickly checked and it seems that the xtable() method for "lm" objects
just relies on the fact that

   summary(object)$coef

is the matrix with coef/std.error/t-stat/p-value. As this is the case for
"plm" objects, I think you can do

   xtable.plm <- xtable:::xtable.lm

and then

   xtable(plm_object)

should give the desired result.

hth,
Z

> Thanks,
> -stephen
> ==========================================
> Stephen J. Barr
> University of Washington
> WEB: www.econsteve.com
>
> ______________________________________________
> [hidden email] 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.
>
>

______________________________________________
[hidden email] 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.