[R] lmer and mixed effects logistic regression

Spencer Graves spencer.graves at pdf.com
Wed Jun 21 17:35:15 CEST 2006

	  You could think of 'lmer(..., family=binomial)' as doing a separate 
"glm" fit for each subject, with some shrinkage provided by the assumed 
distribution of the random effect parameters for each subject.  Since 
your data are constant within subject, the intercept in your model 
without the subject's random effect distribution will be estimated at 
+/-Inf.  Since this occurs for all subjects, the maximum likelihood 
estimate of the subject variance is Inf, which is what I wrote in an 
earlier contribution to this thread.

	  What kind of answer do you get from SAS NLMIXED?  If it does NOT tell 
you that there is something strange about the estimation problem you've 
given it, I would call that a serious infelicity in the code.  If it is 
documented behavior, some might argue that it doesn't deserve the "B" 
word ("Bug").  The warning messages issued by 'lmer' in this case are 
something I think users would want, even if they are cryptic.

	  Hope this helps.
	  Spencer Graves	

Rick Bilonick wrote:
> 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.
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list