[R] random effects using lmer
Ben Bolker
bbolker at gmail.com
Wed Apr 18 15:02:04 CEST 2012
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
More information about the R-help
mailing list