Skip to content
Prev 7570 / 20628 Next

glmer error

Hi Felipe,

Your problem is probably not too difficult to fix given some data.
The error message comes from glm.fit.  glmer() actually fits a basic
logistic model prior to fitting the random coefficient model.  You are
running into problems at this stage.  You can get to this stage pretty
easily, which simplifies debugging.

Lacking data, I wrote a short function to simulate some binary data here:

https://gist.github.com/1850238

require(lme4)
## simulate data
dat <- bsim(reps = 10)

## your formula
f <- Y ~ X + W + (1 | G)
## your call to glmer (
mc <- call("glmer", formula = f, data = dat, family = binomial(link = "logit"))
m <- eval(mc) # evaluate the glmer call (works on my data, fails on
yours, presumably)

## use the glmer call to extract the frames passed to glm.fit
base <- lme4:::lmerFrames(mc, f, NULL)
## run the logistic model (the error suggests you run into problems here)
m2 <- glm.fit(base$X, base$Y, family = binomial(link = "logit"))
m2$converge ## should be true if it runs

you can do debugging, traceback() etc. at this stage, which should
make your life a little easier.  I would examine the X and Y matrices,
check for separation, etc.

if your x variable is categorical, try looking at at the crosstabs of
it with your outcome a l?:

xtabs(~ y + x)

also in any follow up emails to the list, please report the output of
sessionInfo() per the posting guide.  The version of R/lme4 you are
running may be relevant (alternately, upgrade to the latest stable
release of R and lme4).  Douglas Bates et al have been active working
on development, and it would be rather silly for us to spend time and
confusion because we are using one version and you are using another
and neither side realizes it.

Cheers,

Josh
On Wed, Feb 15, 2012 at 9:31 AM, Felipe Nunes <felipnunes at gmail.com> wrote: