Skip to content

glmer error

4 messages · Felipe Nunes, David Duffy, Rune Haubo +1 more

#
On Wed, 15 Feb 2012, Felipe Nunes wrote:

            
You need to provide us with a subset of your dataset that causes the same 
problem.  Alternatively, debug(glm.fit) and look at the contents of 
"x[good,]" etc.  Maybe it's separation.
#
On 16 February 2012 02:35, David Duffy <David.Duffy at qimr.edu.au> wrote:
Will data=pool solve it?

/Rune

PS: REML=T makes no sense for GLMMs and is, I believe, just ignored.
#
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: