[R] PLM falling into dummy variable trap -- how to fix?

Andrew Crane-Droesch andrewcd at gmail.com
Sat Feb 22 01:50:48 CET 2014

**Appologies for cross-posting with Stack Overflow**

An example of the problem:

     fem = 
     lsdvm = lm(y~ID+T+G:t,data=sdat)

`fem` is the fixed-effects model (fit with plm), and `lsdv` is the 
equivalent least-squares dummy variable model (fit with lm)

It is clear that plm is estimating the coefficients, and indeed that the 
coefficients are identical in the two models, as they should be.  But 
when I go to summarize the results, plm is having a hard time, and I'm 
pretty sure that the reason is the timeXgroup fixed effects, some of 
which need to be auto-omitted because of the dummy variable trap.  (lm, 
for example, seems to know how to automatically remove variables that 
are exact linear combinations of each other).

How do I get around this?  I'd prefer to stay with plm, as it gives much 
more parsimonious output than lm with dummy variables for each 
cross-sectional unit.  plm is also convenient for lags.


More information about the R-help mailing list