[R] corrigendum on fixed effects and R2 in within models

Millo Giovanni Giovanni_Millo at Generali.com
Thu Sep 22 18:07:07 CEST 2011


Dear list, dear Cecilia and Daniel,

sorry for coming in ten days late, I've been very busy lately so I came
across this email only today.

This is just to make some points clearer re: fixed effects and r2 in
package 'plm', to both you and the list. In particular, to make you
aware of some additional features.

Please see my comments below, with '##'. 

Best,
Giovanni 

------------ original thread ------------------

Message: 49
Date: Mon, 5 Sep 2011 21:43:02 -0700 (PDT)
From: Daniel Malter <daniel at umd.edu>
To: r-help at r-project.org
Subject: Re: [R] plm package, R squared, dummies in panel data
Message-ID: <1315284182071-3792582.post at n4.nabble.com>
Content-Type: text/plain; charset=UTF-8

Hi, I answered this question before in this post:
http://r.789695.n4.nabble.com/Regressions-with-fixed-effect-in-R-td21733
14.html
, specifically in my message from May 11, 2010; 4:30pm.

However, I believe the newer version of plm shows an R-squared, which
should
be the within R-squared. 

## it is, at least in the case of "within" models. Actually, for each
model it is the r-squared on the relevant transformed data.

Why the programmers of the package decided to not
show the others or to not provide a test of the significance of the
a(i)s, I
don't know.

## in fact we do, and we have done since mid-2010 (shortly after the
thread you reference in your post). See ?r.squared, and in particular be
aware of the 'model' argument. The a_i are there as well, see below. PS
as for the general reason for not doing something, lack of time is
always a good guess ;^)

As for your second question, the plm function has an option as to
whether
the FEs should be "id", "time", or "twoways", i.e., for id and time. I
would
guess that then the time FEs are not estimated either but differenced
out,
too.

## sort of. The standard way for estimating one or two-ways FE models is
to demean the data. If you want the first-difference model, try plm(...,
model="fd").
## The fixed effects are nevertheless available, they can be recovered
later: see ?fixef and ?summary.fixef for t-tests for significance of
single effects. See ?pooltest for the joint test of significance of all
FEs. 

 This should affect the within/between variance and therefore the within
and between R-squareds.

## it is the (different flavours of-) r2s that are *defined* according
to the transformation used. Yet, as I said above, you can have them all,
just ask (-the software!).

HTH,
Daniel


Cecilia Carmo wrote:
> 
> Hi R-helpers,
> 
>  
> 
> I have two questions I hope you could help me with them:
> 
>  
> 
> In the plm package how can I calculate the R2 within, R2 between and
R2
> overall? Is there any special reason to not display these values?
> 
>  
> 
> When using first differences do I need to have some special care with
> dummies (both year dummies and industry dummies)? 
> 
> (A friend who works with Stata told me that there is necessary to
> construct
> some ?accumulated dummies?.)
> 
>  
> 
> Thank you very much,
> 
>  
> 
> Cec?lia Carmo
> 
> (Universidade de Aveiro ? Portugal)
---------- end original thread -------------

Giovanni Millo, PhD
Research Dept.,
Assicurazioni Generali SpA
Via Machiavelli 4,
34132 Trieste (Italy)
tel. +39 040 671184
fax  +39 040 671160

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



More information about the R-help mailing list