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

Achim Zeileis Achim.Zeileis at uibk.ac.at
Wed Mar 17 17:50:44 CET 2010


On Wed, 17 Mar 2010, Liviu Andronic wrote:

> Dear Achim
>
> On 3/16/10, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote:
>>  Hence, when saying summary() different models with "no effects" are
>> assumed. For gr_fe the model without effects just omits value/capital but
>> keeps the firm-specific interecepts. For gr_lm not even the intercept is
>> kept in the model. Thus:
>>
>>  gr_fe_null <- lm(invest ~ 0 + firm, data = pgr)
>>  gr_lm_null <- lm(invest ~ 0, data = pgr)
>>
> What would be the more useful "no effects" model in the plm(...,
> effect="twoways") case? Considering the same setting,
> library("AER")
> data("Grunfeld", package = "AER")
> library("plm")
> gr <- subset(Grunfeld, firm %in% c("General Electric", "General Motors", "IBM"))
> pgr <- plm.data(gr, index = c("firm", "year"))
>
> I am fitting a "twoways" model and an "individual" with manually
> specified time effects.
>> gr_fe1 <- plm(invest ~ value + capital, data = pgr,
> +    model = "within", effect="twoways")

[snip]

> Following the reasoning in your previous e-mail, I assume that the
> (more useful) "no effects" model used in the "twoways" case is
>> gr_fe1_null <- lm(invest ~ 0 + firm + year, data = pgr)

Yes.

> However I cannot replicate the F-statistic: 107.246.
>> anova(gr_fe1_null, gr_fe1)

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.

In short:
   - plm(..., model = "within") offers a convenient approach of what
     is usually done in this kind of analysis.
   - 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.

Best,
Z



More information about the R-help mailing list