Solved – Interpreting a binned residual plot for logistic regression

lme4-nlmelogisticregressionresiduals

I have the following mixed effect logistic regression:

    ball3=glmer(Buried~Offset+Width_mm+(1|Chamber), family=binomial, data=ballData)

And I would like to check the residuals vs predicted plot to check that the residuals look OK. Using the advice offered on previous CV questions (here and here), I have created a binned residual plot for my model using the following code:

    binnedplot(fitted(ball3), resid(ball3))

The resulting plot looks like this:

enter image description here

Only one of the binned residuals is substantially outside of the +/- 2 SE bounds, which is roughly inline with the expectation of 95% of binned residuals falling in the +/- 2 SE range.

However, regarding the overall shape of the plotted points, I cannot find much infomation on what the binned residual plot should look like. I am assuming that it should be a random scatter of points, with no pattern. Is this correct?

If this is correct, my model may be problematic because there does seem to be a positive relationship between the expected values and average residuals. A similar problem was identified here, and the problem seemed to be caused by "the residuals being on the logit scale but expected values were on the response scale". Once the the residuals were plotted on the response scale, the binned residual plot looked alot better.

How can I tell if I have plotted my residuals on the logit scale but expected values on the response scale, or vise versa? And how can I correct this problem if I have?

Best Answer

I think I have solved my problem, which Im posting here in case it is useful to anyone else. By defining my binned residual plot as:

    binnedplot(fitted(ball3), resid(ball3,type="response"))

The fitted and residuals are now both on the response scale (i.e. between 0 and 1) (I think...Im far from a stats wizz). The binned residual plot looks alot better