Skip to content

how to fit just a fixed effects model?

3 messages · Pijus Virketis, Peter Dalgaard, James McBroom

#
Dear all,

How can one fit just a fixed effects model in R? lme() seems to require a random component, whereas I am just looking for something like STATA's "xtreg, fe" function. 

Thanks,

Pijus


----
W: 212-588-7897
F: 212-446-1955 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"Pijus Virketis" <pvirketis at hbk.com> writes:
Just lm() 

It *is* curious that you can't get lme() to come out with that special
case, though. You can, however, cheat it with code like
This gives you


Random effects:
 Formula: ~1 | z
        (Intercept)  Residual
StdDev:    2.127071 0.7976516

although the terms are not really separately identifiable, only 
the residual error sqrt(2.127071^2+ 0.7976516^2)...
#
Pijus,

The gls function in the nlme library allows you to fit a linear model 
under certain error assumptions (eg some types of correlation), which 
might line up with those you'd use xtreg for in Stata.

James.
Pijus Virketis wrote: