I am trying to analyse the effects of several main factors, interactions and random effects on a continuous response variable. In other analysis, modifying the glmer control was sufficient.
I've changed the family of the glmer as suggested here, but the model did not converge (or did not work when I put quasi-poisson or quasi-binomial). Could someone explain the difference between negative binomial and poisson, and why/whether it would be appropriate to substitute them? Residual diagnostics for GLM using DHARMa – Sebastian Bergstrom's blog for side projects
I would like to understand the cause of this error and how to remedy it. I assume the current model is not correct.
> durationfull2<-glmer(DURATION.centered~SEX*STATUS*ENV_QUAL+STATUS*GROUPSIZE.centered+ENV_QUAL*SEASON+(1|INCOMING)+(1|DATE),data=duration4w2,family=Gamma(link = log), nAGQ=1,glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 10000000)))
Increasing the number of iterations in the bobyqa optimizer did not help. Nor did using the glmerControl(optimizer ="Nelder_Mead").
optimizer (bobyqa) convergence code: 0 (OK) unable to evaluate scaled gradient Model failed to converge: degenerate Hessian with 1 negative eigenvalues
I used the package DHARMa on this probably-incorrect model, to exemplify:
#assess fit of the model with DHARMa simulationOutput <- simulateResiduals(fittedModel= durationfull, plot = T)#OK except standardized residuals #deviation significant + quantil signif differ #add quadratic term to account for nonlinearity of group size- does not work summary(duration1=update(durationfull,.~.+I(GROUPSIZE.centered^2)))#ERROR singular fit #tests if there are more zeros in the data than expected from the simulations testZeroInflation(durationfull)#no, p=1 testDispersion(simulationOutput)#dispersion OK, p=0.09 testResiduals(simulationOutput)#OK p=0.14 #test if the overall distribution conforms to expectations testUniformity(simulationOutput) #p= 1.054e-10; Kolmogorov-Smirnov test: deviation significant. #fit a quantile regression or residuals against a predictor (default predicted value), #and test of this conforms to the expected quantile testQuantiles(simulationOutput)#significant: p=2.2e-16
In general, how can we solve the issue of uniformity and quantile? I've looked at the DHARMa R explanation but am still confused.
Many thanks in advance!