[R] nlme fixed effects specification

ivo welch ivowel at gmail.com
Thu May 3 20:03:42 CEST 2007


dear R experts:

sorry, I have to ask this again.  I know that the answer is in section
7.2 of "S Programming," but I don't have the book (and I plan to buy
the next edition---which I hope will be titled S/R programming ;-) ).

I believe the following yields a standard fixed-effects estimation:

fixed.effects = as.factor( as.integer( runif(100)*10 ) )
y=rnorm(100); x=rnorm(100);
print(summary(lm( Y ~ X + fe)))

I would like to know how to get the same coefficient on X using nlme.
(I cannot use this ordinary lm method in my real application, simply
because I have 10,000 fixed effects.)  I tried a variety of arguments
to the "fixed" nlme parameter (e.g., fixed=list(fmid)), but did not
get the syntax right.  could someone please tell me the magic spell?

may I also suggest that such an example be added to the nlme examples
documentation, too, please?

help appreciated.

regards,

/ivo



More information about the R-help mailing list