Understand warning messages for mixed model in r lme4

phish_researcher picture phish_researcher · Jun 13, 2014 · Viewed 9.9k times · Source

I have built and run a mixed effects logistic regression model in the lme4 package for r to estimate the probability of occupancy of fishes in different locations (cells/habitats). The data frame consists of 1,207,140 observations of 68 individual fish. For each individual (per day for ~ 1 year) it describes the the number of occurrences at each unique location relative to the total number of occurrences in all locations.

Here is the base model:

    m.base = glmer(cbind(N,t.move-N) ~ jdate + snSurface.Area + Restoration..P.A. +    
    Release.Location+ Sex + (1|Station) + (0 + jdate|ID), data=allfishdat, family=binomial)
where N=# unique positions, t.move=total positions, jdate=julian date, Station=locations, ID=fish ID

I get the following warning message:

Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
                Model failed to converge with max|grad| = 3349.26 (tol = 0.001)
2: In if (resHess$code != 0) { :
 the condition has length > 1 and only the first element will be used
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
 Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?

I done some searching to try to understand what these messages mean and their implications on the model, but have not yet understood the warnings.

Answer

It Figures picture It Figures · Jun 15, 2014

If the first problem has to do with R needing to go through more iterations to reach convergence, the code below may help. Replace '20000' with whatever max iteration number makes sense for your specific model. (Notice that your original model code has been modified at the end to include 'control = my.control'.)

my.control=lmerControl(optCtrl=list(maxfun=20000); my.control

m.base = glmer(cbind(N,t.move-N) ~ jdate + snSurface.Area + Restoration..P.A. +  Release.Location+ Sex + (1|Station) + (0 + jdate|ID), data=allfishdat, family=binomial, control = my.control)

It may also be useful to you to review your current lmeControls with the following command:

str(lmerControl())

Further, this previous answer may be helpful to you: increase iterations for new version of lmer?