Like many others, I am having problems with a model that uses the glmer function from the lme4 package.
Here is my model:
model = glmer(depvar ~ variety*cover+amplitude+time+ (1|pp) + (1|stim),
data = datafile, family=poisson)
And here is the warning I get:
Warning message:
In checkConv(attr(opt, "derivs"), opt$par,
ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.00606839
(tol = 0.001, component 1)
I read this link to add
control=glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=100000))
At the end of my model, I will solve the problem. I tried, so now my model is:
model = glmer(depvar ~ variety*cover+amplitude+time+
(1|pp) + (1|stim), data = datafile, family=poisson,
control=glmerControl(optimizer="bobyqa",
optCtrl=list(maxfun=100000)))
and it works without warning.
I would like to ask if anyone can explain what I am adding to the model because I am not sure if I understand this. Also, is this an acceptable solution to solve the warning problem? Or did someone decide this differently?
Many thanks.
Output without control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000))):
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: poisson ( log )
Formula: depvar ~ variety * cover + amplitude + time + (1 | pp) + (1 | stim)
Data: datafile
AIC BIC logLik deviance df.resid
6916.6 6963.1 -3450.3 6900.6 2473
Scaled residuals:
Min 1Q Median 3Q Max
-0.8955 -0.4712 -0.2797 0.3163 3.0090
Random effects:
Groups Name Variance Std.Dev.
stim (Intercept) 0.031757 0.17821
pp (Intercept) 0.008918 0.09443
Number of obs: 2481, groups: stim, 200; pp, 28
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.77480 0.21459 3.611 0.000305 ***
variety2-1 0.04813 0.03096 1.555 0.119969
cover2-1 0.06725 0.03096 2.172 0.029862 *
amplitude -0.04704 0.02685 -1.752 0.079837 .
time -0.02545 0.03747 -0.679 0.496943
variety2-1:cover2-1 0.01435 0.06170 0.233 0.816128
---
Signif. codes: 0 β***β 0.001 β**β 0.01 β*β 0.05 β.β 0.1 β β 1
convergence code: 0
Model failed to converge with max|grad| = 0.00606839 (tol = 0.001, component 1)
Output from control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000))):
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: poisson ( log )
Formula: depvar ~ variety * cover + amplitude + time + (1 | pp) + (1 | stim)
Data: datafile
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
6916.6 6963.1 -3450.3 6900.6 2473
Scaled residuals:
Min 1Q Median 3Q Max
-0.8956 -0.4712 -0.2797 0.3163 3.0090
Random effects:
Groups Name Variance Std.Dev.
stim (Intercept) 0.031759 0.17821
pp (Intercept) 0.008917 0.09443
Number of obs: 2481, groups: stim, 200; pp, 28
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.77480 0.21457 3.611 0.000305 ***
variety2-1 0.04813 0.03096 1.555 0.119997
cover2-1 0.06725 0.03096 2.172 0.029860 *
amplitude -0.04703 0.02685 -1.751 0.079861 .
time -0.02545 0.03746 -0.679 0.496889
variety2-1:cover2-1 0.01434 0.06170 0.232 0.816160
---
Signif. codes: 0 β***β 0.001 β**β 0.01 β*β 0.05 β.β 0.1 β β 1