HughSt <hughsturrock <at> hotmail.com> writes: > I am trying to run a logistic regression to look at the risk of malaria > infection in individuals. I want to account for intra household correlation > and so want to include a household level random effect. I have been using > the lmer command in lme4 package but am getting some strange results that > are completely different to those I get using STATA. > > Can I just check that this is the correct code > > lmer(IsPos ~ Dist + (1 | HouseID), family=binomial)
This does seem reasonable, although I would probably use glmer() rather than lmer() for clarity [lmer() automatically calls glmer() when 'family' is specified] > Where IsPos is a binary vector of positives and negatives, Dist is the > variable of interest and HouseID is the household ID number. > > For those STATA users, the equivalent I'm using is > > xtlogit IsPos Dist, i(HouseID) > So you're not doing anything obviously silly. It seems that STATA uses gauss-hermite quadrature by default -- glmer uses Laplace, so you might try something like nAGQ=10 and see if anything changes. Follow-ups should go to r-sig-mixed-models <at> r-project.org ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.