I am trying to fit a mixed effects model with a binary outcome. I have one fixed effect (Offset) and one random effect (chamber, with muliple data points coming from each chamber).
In the text book "The R Book", (2007), pg 604, Crawley suggests using the lmer function with a binomial family for the analysis of binomial data where each participant contributes multiple responses (analagous to each of my chambers contributing multiple outcomes). Based on this example, I have used the following script for my data:
ball=lmer(Buried~Offset+(1|Chamber), family=binomial, data=ballData)
When I run this model, I get this warning:
calling lmer with 'family' is deprecated; please use glmer() instead
When I change my code to the following, the model works:
ball=glmer(Buried~Offset+(1|Chamber), family=binomial, data=ballData)
Based on other questions/answers that I have read on Cross Validated, lmer should only be used for data where the outcome is normally distributed, and glmer is the correct function to use for a binomial outcome. My questions are:
1) Could anyone clarify the discrepency between Crawleys advice and the fact that lmer would not work for me (nor, based on what I have read on CVed, is it recommended to use this function for binomial data)
2) Is glmer indeed the correct function to use to model a binomial outcome with random factors?
3) Assuming that glmer is the correct function to use, I want to compare a model with and without random effects to determine if including random effects improves the fit of the model. I understand that glmer estimates model parameters via maximum likelihood. What function can I use to create a model with no random effects for a binary outcome using maximum likelihood? I was playing around with glm however the help file for this function states that the method of estimation is iteratively reweighted least squares (which is beyond me, but it isn't ML...)
lmer
is no longer appropriate to use with binary outcomes, it is not the case that "lmer should only be used for data where the outcome is normally distributed". More information on this issue is available here. $\endgroup$