[R] plm "within" models: is the correct F-statistic reported?

Liviu Andronic landronimirc at gmail.com
Wed Mar 17 20:05:43 CET 2010


On 3/17/10, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote:
>  Here, you compare apples and oranges. gr_fe1 is of class "plm" and
> gr_fe1_null is of class "lm". This does not fly.
>
>  gr_fe1_lm <- lm(invest ~ 0 + value + capital + firm + year, data = pgr)
>  anova(gr_fe1_lm, gr_fe1_null)
>
>  which does the job.
>
Indeed, I see.


>  In short:
>   - plm(..., model = "within") offers a convenient approach of what
>     is usually done in this kind of analysis.
>
Unfortunately plm(..., effect="twoways", model = "within") fails on my
particular unbalanced panel data (100% CPU and the task never
finishes); there are no such issues with "individual" or "time". Worse
is that I cannot replicate the issue on dummy data.


>   - You can replicate everything by hand using lm() but have to take
>     care of everything yourself. But you do get the same results.
>
>   - Don't mix the two approaches.
>
I wanted to avoid displaying >2000 individuals in the regression
coefficients, the reason for trying the mix-up. I also tried to do the
trick using a plm() model for the null, too, but there is no anova
method for these.

> gr_fe1 <- plm(invest ~ value + capital, data = pgr,
+    model = "within", effect="twoways")
> gr_fe1_null <- plm(invest ~ 0 + firm + year, data = pgr, model = "pooling")
> anova(gr_fe1_null, gr_fe1)
Error in UseMethod("anova") :
  no applicable method for 'anova' applied to an object of class
"c('plm', 'panelmodel')"

And having checked the source, I wouldn't venture to implement one.
I'm still a bit stuck on how to proceed. Thank you
Liviu



More information about the R-help mailing list