I'm running a GLMM through the lme4 package in R to detect differences in time spent feeding (response) before and after birth (my 2 categories in the variable inf_cat). I started with a Poisson GLMM, with female ID as a random effect (because I have repeated measures) and an offset of the total amount of time observing the female in a block (to avoid using proportion values):

ba.feed <- glmer(feeding ~ inf_cat + offset(total_inf_cat) + 
    (1|female), family=poisson, data=mothers_beforeafter)

The summary showed that my data had overdispersion so I switched to a negative binomial GLMM, but it gave me this error message:

boundary (singular) fit: see ?isSingular

The summary shows that the variance of my random effect is 1.255e-11.

From my understanding, this singular fit comes from either a model that is too complex or not enough random effects levels. I've been troubleshooting with this site but I'm still confused about what I can do moving forward. I don't think I'm able to simply drop my fixed effect variable and rerun the model because I have repeated measures in my dataset.


1 Answer 1


The among-female variance (from the (1|female) term) and the overdispersion (from the NB fit) are sharing/competing for the variability around the fixed-effect values, so it's not surprising that the estimated among-female variance would decrease (in this case to zero) when you move to a NB model.

I don't see anything wrong with

MASS::glm.nb(feeding ~ inf_cat + offset(total_inf_cat) + female, ...)


glmmTMB::glmmTMB(feeding ~ inf_cat + offset(total_inf_cat) + female,
                 family = nbinom2, ...)

(i.e. converting the (1|female) random effect to a fixed effect of female). Or you could simply drop the (1|female) term (this should have no effect on the fitted model, as the among-female variance was already estimated as effectively zero.)

If you feel very strongly about keeping the random effect of female, and not wanting it to be singular, then you need to regularize (e.g. using the blme package) or go Bayesian (e.g. rstanarm::stan_glmer(), MCMCglmm).


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.