Skip to content

boundary (singular) fit and failure to converge

2 messages · Rafael Lima Oliveira, Ben Bolker

#
Dear mailing list at R-sig-mixed-models,



I have a dataset of environmental variables (salinity, temperature, pH,
dissolved oxygen, turbidity and depth) as predictors and as response
variables fish species richness.



Initially, I ran a Poisson-GLMM and this is my model:



poissonmodel<- glmer(Richness~ Salinity*Locality + Temperature*Locality +
pH*Locality + DO*Locality + Turbidity*Locality + Depth*Locality + (1
|Month) + (1|Locality/Site), family="poisson", data = dados)



Warning message:

In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :

  Model failed to converge with max|grad| = 0.00485978 (tol = 0.002,
component 1)



The random-effect variances being estimated as zero (or close to 0)
indicates that my model should be simplified? Should I remove the random
effects terms without substantial loss of fidelity to the data?



The Random structure that I created in my model account for my nested
design, where: (1 |Month) account for temporal variability of my dataset
collected monthly during 1 year and (1|Locality/Site) where indicated that,
spatially my data are nested, in this case "Site" nested in "Locality".



Overdispersion test to Poisson model indicated a dispersion rate of 1.632.
Once overdispersion is detected, I?m refitting my model with negative
binomial distribution (function ?glmer.nb) and variance of the random
effects also was close to 0.



*This is my negative binomial model:*



binomialmodel<- glmer.nb(Richness~ Locality + Salinity*Locality +
Temperature*Locality + pH*Locality + DO*Locality + Turbidity*Locality +
Depth*Locality + (1 |Month) + (1|Locality/Site), data = dados)



After run my model some warnings appeared:



*- boundary (singular) fit: see help('isSingular')*



and two warnings about Convergence:



*1:* In optTheta(g1, interval = interval, tol = tol, verbose = verbose,
failure to converge in 10000 evaluations

*2:* In optTheta(g1, interval = interval, tol = tol, verbose = verbose,  :
convergence code 4 from Nelder_Mead: failure to converge in 10000
evaluations



The random effects that I specified in my model are not really needed? If I
remove the random effects, can I change the GLMM approach to GLM approach?



If anybody has any tips on this please give me a hand.

Hope you can understand it.



With many thanks and kind regards,



Rafael
#
On 2022-09-13 10:25 a.m., Rafael Lima Oliveira wrote:
If you remove a term whose variance is estimated as zero, you're not 
losing *any* fidelity to the data ... in general, the recommendation is 
that terms that are fitted as singular probably indicate an 
overfitted/overly complex model (see e.g. Barr et al 2013 "Keep it 
maximal", Matuschek et al 2017 "Balancing Type I error" -- both agree 
that singular terms can be removed)
You should definitely increase the number of function evaluations. 
(Not sure why this is using Nelder-Mead, which is usually *not* the most 
robust of the available options ... ?)

   You could also try glmmTMB, which is a bit faster/more robust when 
fitting negative binomial models.
If *all* of your REs have variance zero then yes, you probably won't 
lose anything by dropping back from GLMMs to GLMs.