# After trying various optimzers, model simplification running more iterations, when fitting GLMMs, R still produces warning messages

I am trying to fit GLMM's to my data using the glmer function available in R's lme4 package. The data is available at: https://onedrive.live.com/redir?resid=1B727FC7180E87DF%21118

I keep getting warning messages. Can anybody help me get rid of them.

I am re-posting this from StackOverflow after someone's kind suggestion. That person also suggested that the main of the issue may be low number of virus positive samples n=12. Which I suspected. But I am also wandering if linear separation could be an issue, as all the virus positives occur in the low food group. Can these problems be resolved using GLMMs or should I think of other statistical tests?

Tried fitting the model:

Food_Treatment.glmer <- glmer(Virus_DNA~Food*Treatment+(1|Set),
family=binomial,data=data,method = "ML")

to get the warning messages

Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.001101 (tol = 0.001, component 3)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge: degenerate Hessian with 4 negative eigenvalues

After running code with more iterations of the model, I still get the same warning messages:

Food_Treatment.glmer <- glmer(Virus_DNA~Food*Treatment+(1|Set),data=data,
family=binomial,control=glmerControl(optCtrl=list(maxfun=1e9)))

I then looked on-line and that people had similar problems and tried the optmizer bobyqa:

Food_Treatment.glmer <- glmer(Virus_DNA~Food*Treatment(1|Set),data=data,family=binomial,
control=glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=1e9)))

I then got the very similar warning messages:

Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.00393532 (tol = 0.001, component 2)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge: degenerate Hessian with 2 negative eigenvalues

I then thought of simplifying the model and tried no interactions between explanatory variables, with the code:

Food.Plus.Treatment.glmer<-glmer(Virus_DNA~Food+Treatment(1|Set),family=binomial,
data=data)

and

Food.Plus.Treatment.glmer<-glmer(Virus_DNA~Food+Treatment(1|Set),family=binomial,
data=data,control=glmerControl(optCtrl=list(maxfun=1e9)))

Only to get the warning messages :

Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.00248016 (tol = 0.001, component 2)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge: degenerate Hessian with 1 negative eigenvalues

So I tried this simplified model with the optimizers bobyqa and Nelder_Mead, as well as the optimzers nlminb and L-BFGS-B from the package optimx.

All but the bobyqa optimizers produce variations on the 2 warning messages. The bobyqa optimizer produces the 1 warning message:

Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.00139574 (tol = 0.001, component 2)

P.S. This is my first post on here I hope I have provided enough information without being verbose and it is correctly formatted.

• The help discourages cross-posting. You should pick one best place for your post. – Glen_b Aug 12 '14 at 10:50
• Variable Set has only 6 categories. My guess is that this is not enough information to appropriately estimate the variance of the random effects. Most books on multilevel modeling suggest sample sizes of >=15 for level two units. You might want to include Set as a fixed effect and estimate a simpler glm() model. – Bernd Weiss Aug 12 '14 at 11:17
• Could you suggest which books you are talking about. I have the 2nd edition of the R book. If it is in there I may have missed it. I have analysed set (which should be called block) as a fixed effect in a glm. But I would like to if possible analyse it as a random effect as well, as it could be argued that it is either a fixed effect or random. Set is the set samples where analysed in 1st, 2nd, 3rd, 4th, 5th and 6th. As it is an ordered event some would argued that it is a fixed effect and some random. Analyses by GLMM as well as GLM is to cover both arguments. – Martin David Grunnill Aug 12 '14 at 11:26
• I have posted a full answer. Regarding the terminology: I apologize but I am not too familiar with the terminology of 'blocks'; in the social sciences we talk about level two units, groups, clusters etc. – Bernd Weiss Aug 12 '14 at 11:42

Variable Set has only 6 categories. My guess is that this is not enough information to appropriately estimate the variance of the random effects. Most books on multilevel modeling suggest sample sizes of $\geq 15$ for level two units. You might want to include Set as a fixed effect and estimate a simpler glm() model.