I'm trying to fit a generalized linear mixed model (GLMM), but I'm getting a persistent error. I'm looking at the relationship between weather (continuous variables: rainfall, maxtemp, and mintemp) and attendance at a zoo (count response). I also want to include whether or not its a weekend and the year as other variables (factors with 2 and 16 levels respectively). A basic model I've come up with is:

model <- glmer(attendance ~ lograinfall_plus1 + 
                        maxtemp + mintemp + weekend + 
                       (1 | year), 
                       data = summer, 
                       family = poisson(link = "log")) 

I got the following error:

Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables? 

I then standardized the numeric predictors using datawizard, but I still got the same warning message. The model summary is below:

Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [
 Family: poisson  ( log )
Formula: attendance ~ lograinfall_plus1 + maxtemp + mintemp + weekend +  
    (1 | year)
   Data: summer
Control: glmerControl(optimizer = "bobyqa")

      AIC       BIC    logLik  deviance  df.resid 
 434265.4  434294.8 -217126.7  434253.4       986 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-81.394 -13.661   0.082  13.149  67.756 

Random effects:
 Groups Name        Variance Std.Dev.
 year   (Intercept) 0.02187  0.1479  
Number of obs: 992, groups:  year, 16

Fixed effects:
                    Estimate Std. Error z value Pr(>|z|)    
(Intercept)        8.5226624  0.0369743   230.5   <2e-16 ***
lograinfall_plus1 -0.1779357  0.0005204  -341.9   <2e-16 ***
maxtemp            0.0892090  0.0005407   165.0   <2e-16 ***
mintemp           -0.0594439  0.0004998  -118.9   <2e-16 ***
weekendTRUE        0.2458572  0.0009008   272.9   <2e-16 ***
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) lgrn_1 maxtmp mintmp
lgrnfll_pl1  0.002                     
maxtemp     -0.001  0.322              
mintemp      0.000 -0.261 -0.479       
weekendTRUE -0.008 -0.017  0.018  0.027
optimizer (bobyqa) convergence code: 0 (OK)
Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?

There are some zeros in the rainfall data and my response variable is clustered as it is repeated measurements from the same zoo. I'm not sure if this helps.

Additional Info

To clarify, yes, there is only one zoo, and I was looking at the number of people attending as a count variable.

My Supervisor advised that I use a GLMM as the observations are clustered and not independent because they come from the same zoo.

Here are the visuals from my data:

There seems to be non-linearity in the relationship between the weather variables and zoo attendance

enter image description here

The Corr Plot shows no significant correlation between explanatory variables, only a moderate one between max and min temp

enter image description here

I was putting 'year' as a random effect as it seems attendance increases slightly over the 16 year period but I'm more interested in looking at the impact of the weather variables. enter image description here

Also, the attendance figures range from 0-12215 so could this be considered continuous?

Another method I was considering was fitting a glm and adding an autoregressive term which could account for the temporal correlation between the observations. Would this be a better approach?

  • 5
    $\begingroup$ I'm not sure that it makes sense to model this as a mixed effects model. Do you have any interest in temporal effects ? Why not use a GLM with year as a numeric variable ? There isn't much variation in due to year anyway. $\endgroup$ Commented Jun 15 at 17:25
  • 1
    $\begingroup$ I think "zoo" should be the random effect, and year a fixed effect. $\endgroup$
    – Michael M
    Commented Jun 15 at 18:40
  • 4
    $\begingroup$ @MichaelM interesting idea, but I think there is only one zoo (I could be wrong, but that was my working hypothesis) $\endgroup$ Commented Jun 15 at 18:45
  • 2
    $\begingroup$ That's possible. Maybe @Hazel can give some additional info? $\endgroup$
    – Michael M
    Commented Jun 15 at 18:53
  • 1
    $\begingroup$ @MichaelM that would be nice ! Just re-reading the question, "attendance at a zoo (count response)" indicates to me that there is only 1 zoo ("a" zoo), and that the number of people attending is a count. Anyway, as you say, we need Hazel to respond. $\endgroup$ Commented Jun 15 at 19:01

1 Answer 1


This kind of problem, in my experience, is an indication that the model is misspecified. In this particular scenario, a couple of things spring to mind:

  • First visualise the data

It is quite common for visualisations to inform the modelling process. I for one do not understand why researchers would not visualise their data before starting to write code. For me it is an essential part of the modelling process. I don't know whether or not the OP ran some visualisation routines or not, but there is no indication in the OP that they did. For example a correlation plot. In R, the corrplot package has excellent functions to investigate the correlations among the data. One reason for the warning you received could be multicollinearity among the explanatory variables. A correlation plot will immediately identify pairs of variables that are highly correlated. Then you can either drop variables from the analysis or use a penalised/regularised approach such as the Lasso.

  • Misspecified random structure

It is not clear to me why year should be treated as random. It seems that the data were collected over a 16 year period. I would start with a model that treats year as a discrete variable and as a fixed effect. This is a very good way to identify possible nonlinear associations. When the estimated coefficients of the discrete levels of the year variable differ considerably, it indicates a non-linear association. If this does not uncover such nonlinear association then fitting the model with year as continuous (aka numeric in R) will make sense (as well as simplifying the output and saving 15 degrees of freedom). On the other hand if non-linearity is observed then you could switch to a GAM-based model, or stay within the GLM framework and model year using regression splines.

  • Nature of the response variable

The OP says that the response is "attendance at a zoo (count response)". If the numbers attending the zoo are large then it may be perfectly reasonable to treat the response as continuous, and negate the need for a generalised model completely.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.