I am new to lme4 and I am not sure if I understand correctly. If I want to know if there is an interaction between A and B, I have to write two models and then compare them with anova and the one with the lowest AIC is the one that fits the data better.

So I wrote this two models:

model1 <- glmer(accuracy ~ var1 + var2 + (1 | participant), 
                data = xdat, family = binomial())
model2 <- glmer(accuracy ~ var1 * var2 + (1 | participant), 
                data = xdat, family = binomial())

Model one has a lower AIC value. Model2 did not converge. In the output, model2 tells me there is an interaction at one of the levels of var1 with one of the levels of var2.

Can I say there is no interaction because the best model does not include it, or should I say there is because the model designed to test it includes it and says at one of the levels of the variables it is significant, even if the thing did not converge?


A couple of points:

  • If the model has not converged, it may not be wise to trust results from it (depending also on the warning message your received for non-convergence). You should try to refit the model changing the optimization algorithm. In addition, you should specify more quadrature points, i.e., check the nAGQ argument of glmer() - you should set that to at least 11 or 13. You could also give a try in the GLMMadaptive package.
  • You need not to look at the AIC to see which model is better. If the p-value from the likelihood ratio test is significant, it means that the more complex model (i.e., in this case model2) provides a better fit to the data.
  • $\begingroup$ Wow, I didn't know that. The test was significant and model2 provides a better fit but it does not converge. I tried setting nAGQ to 11 and got a warning: Error in updateGlmerDevfun(devfun, glmod$reTrms, nAGQ = nAGQ) : nAGQ > 1 is only available for models with a single, scalar random-effects term $\endgroup$ – Lili Apr 14 at 18:08
  • $\begingroup$ Try the GLMMadaptive package. $\endgroup$ – Dimitris Rizopoulos Apr 15 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.