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.
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 includeSet
as a fixed effect and estimate a simplerglm()
model. $\endgroup$