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:
I'm trying to fit the model glmer(dummy ~ x + time + (time | subject), data, family=binomial(link = "logit"), REML=T, verbose=T) but I keep receiving the following error: Error in glm.fit(fr$X, fr$Y, weights = wts, offset = offset, family = family, ?: NA/NaN/Inf in foreign function call (arg 1) I omitted NAs, changed the model specification, transformed x to log(x) but nothing solved the problem. I think the problem is on variable 'x' given that is the only one that causes that problem. When I run mod6 <- glmer(dummy ~ a + I(b) + I(c) + d + e + time + (time | subject) + (time|subjectregion), data=pool, family=binomial(link = "logit"), REML=T, verbose=T) I don't have any problem. Any idea about what is happening? * * ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/