1

Stata allows for fixed effects and random effects specification of the logistic regression through the xtlogit fe and xtlogit re commands accordingly. I was wondering what are the equivalent commands for these specifications in R.

The only similar specification I am aware of is the mixed effects logistic regression

> mymixedlogit <- glmer(y ~ x1 + x2 +  x3 + (1 | x4), data = d, family = binomial)

but I am not sure whether this maps to any of the aforementioned commands.

gung - Reinstate Monica
  • 132,789
  • 81
  • 357
  • 650
  • If `x4` is coded as a factor variable R will expand it as a set of dummy variables, which is equivalent [to the fixed effects models](http://www.stata.com/support/faqs/statistics/intercept-in-fixed-effects-model/). – Andy W Apr 22 '14 at 00:41
  • @AndyW I'm slightly confused as the use of `(1 | x4)` seems to be linked with the random effects model which leads to the mixed effects logistic regression [link](http://www.ats.ucla.edu/stat/r/dae/melogit.htm). – georgia2004 Apr 22 '14 at 00:57
  • 1
    Use conditional logistic regression for "fixed effects" logit. http://stats.stackexchange.com/q/87896/24000. R's "survival" package has `clogit()` – ndoogan Apr 22 '14 at 00:57
  • @georgia2004 Sorry for the curtness. Yes you are correct, `(1|x4)` is associated with a random intercept for the `x4` grouping variable. Note with generalized linear models it is a bit more complicated than with OLS - you may not have any variation within the group for the outcome and those groups will need to be dropped for the fixed effects models. – Andy W Apr 22 '14 at 02:01
  • Cross-post on StackOverflow http://stackoverflow.com/q/23208268/604456. – Andy W Apr 22 '14 at 12:56
  • @ndoogan Thank you. This is quite helpful as I think the conditional logistic regression is equivalent to "fixed effects" logit. I wonder why it is under the survival package in R but nevertheless it should work. – georgia2004 Apr 22 '14 at 18:35

0 Answers0