[R] lmer and mixed effects logistic regression

Rick Bilonick rab45+ at pitt.edu
Wed Jun 21 14:59:29 CEST 2006

On Tue, 2006-06-20 at 20:27 +0200, Göran Broström wrote:
> On 6/19/06, Rick Bilonick <rab45+ at pitt.edu> wrote:
> > On Sun, 2006-06-18 at 13:58 +0200, Douglas Bates wrote:
> > > If I understand correctly Rick it trying to fit a model with random
> > > effects on a binary response when there are either 1 or 2 observations
> > > per group.
> If you look at Rick's examples, it's worse than that; each group
> contains identical observations (by design?).
> May I suggest:
> > glm(y ~ x, family = binomial, data = unique(example.df))
> I think lmer gives a very sensible answer to this problem.
> Göran
The paired responses happen to be always the same in the data set that I
have. My understanding is that they could differ, but rarely do. For the
particular single independent variable, it will always be the same for
each observation for a given subject. So I essentially have 2n
observations where there are n unique results. However, I want to add
additional independent variables where the measurements differ within a
subject (even though the response within the subject is the same).

I ran glm on the n subjects and the 2n for lmer and get similar
estimates and se's but not identical. With just one independent variable
where the observations are identical in each cluster, lmer gives
slightly smaller se's using all 2n. When I include a second independent
variable that varies within each subject, lmer gives larger standard
errors, about 25% larger for the independent variable that doesn't vary
within subjects and just slightly larger for the one that does vary.

I could create a data set where I take all subjects with just one
observation per subject and then randomly select one observation from
each pair for subjects who have both observations. But I'd rather not
have to randomly remove observations.

I would expect that when the responses and independent variable are the
same within each subject for all subjects, the residual error must be
zero after you account for a random effect for subjects.

Rick B.

More information about the R-help mailing list