I'm using glmer() in package lme4 and I want to do a mixed effect model to see how my predictor variables contribute to changes in fish abundance. My data looks like this:

data <- data.frame(Year = c("2005", "2006" ..... "2019")

Site= c('A', 'B', 'C', 'D', 'E', 'F'),

Zone= c('Crest', 'Flat', 'Slope'),

Transect= c('1', '2', '3'),

CoralCover= c(0.5, 20, 13, .... "70") #ranging from 0.5-70%

Method = c('UVC', 'SVS') #Different data collection methods

Abundance = c(283, 274, 286....) #Fish count data for every transect

Each transect is a row in my data set (783 rows in total), there are three transects per zone, three zones per site and six sites per year.

My response variable (Abundance) is not normally distributed, so I tried to run a Generalised Mixed Effects Model with Poisson Distribution on the abundance data, with zone being a nested random effect within site;

mixed.glmer <- glmer(TotalAbundance ~ Year + CoralCover + Method + (1|Site/Zone), data = data, family = poisson)

However, doing this gives me this warning message: boundary (singular) fit: see ?isSingular

I tried to put zone as a fixed effect: mixed.glmer <- glmer(TotalAbundance ~ Year + CoralCover + Method + Zone + (1|Site), data = mixedmodel, family = poisson)

Then I get this warning message:

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'm having a hard time interpreting these messages, and I'm not sure if/how I should restructure my data or change my model.

Any advice?


1 Answer 1


Welcome to this forum. It's a bit hard to understand how you should formulate your glmer model because your study design is not fully clear.

If your 6 sites were selected to be representative of a larger set of sites, you can treat them as a random grouping factor sitting at the top of your data hierarchy.

What is not clear is if you:

  1. Selected multiple zones within each site (with the zones selected so they are representative of a larger set of zones) and then within each of these zones you placed multiple transects;

  2. You placed multiple transects within each site (without selecting the zone first).

These two situations would be handled differently in your model specification.

If you selected multiple zones first within each site and then placed multiple transects within each zone, then you would have to treat your zone as a random grouping factor nested in Site and Transect as a random grouping factor nested in zone. This means your model would include something like (1|SiteID/ZoneID/TransectID). In your data, ZoneID would have to be a zone identifier quantified like 1, 2, 3, etc. (e.g., you could use the same numbers for all zones within a site, with the implicit understanding that the meaning of each number changes from site to site). Note that there would be a difference between a zone identifier (e.g., 4) and a zone characteristic (e.g., Flat). The zone identifier would be listed in the construct (1|SiteID/ZoneID/TransectID) which involves all the random grouping factors in your model. The zone characteristic (i.e., Zone) would be listed as a potential predictor in your model: Zone + (1|SiteID/ZoneID/TransectID).

If you selected transects directly within each site (bypassing the selection of zones first), then you would treat Transect as a random grouping factor nested directly in Site: (1|SiteID/TransectID). If you can assess what type of zone each transect is located in, then Zone (e.g., Flat) becomes a transect characteristic of sorts and needs to be included as a transect-specific predictor in your model: Zone + (1|SiteID/TransectID).

For troubleshooting purposes, I would start by clarifying the above so that you are confident of adequately reflecting the random grouping factor implied by your study design. Regardless of which of the two situations you are in, it looks like at the lowest level of your data hierarchy, you have collected your count response variable (Abundance) repeatedly over time for each transect (where time is measured in years). Is that correct?

If it is correct, the first thing to try is fitting the simplest possible random effects model, without any predictors, to make sure it works. In your case, this would be either glmer(Abundance ~ 1 + (1|SiteID/ZoneID/TransectID), ...) or glmer(Abundance ~ 1 + (1|SiteID/TransectID), ...). Make sure all the ID variables are treated as factors by R.

If the above step works fine for your specific study design, you can try expanding the model by adding predictors to it. Each predictor should be coded properly. For example, should Year be coded as a quantitative predictor via as.numeric() or as a categorical predictor via factor()? Should CoralCover be coded as a numeric predictor? etc.

You can try adding one predictor in turns to your model and see if the model fits properly or explodes. If each predictor works fine by itself, try adding them all and see what happens.

In my experience, glmer is not very forgiving when it comes to fitting some models. One thing you can try is using an alternative mixed effects model fitting package to see if you can fit your model that way.

Good luck and you can report here in the comments section how you fared.


Your Answer

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