florianhartig/DHARMa

Interpreting residual pattern for glmer

Closed this issue · 2 comments

kc-li commented

Hi, I fitted a mixed logistic regression model where the dependent variable is a binary variable (switch:0/1), and the independent variables include both categorical (TONE, POS, GENDER, GENERATION, SPEAKER) and continuous variables (FREQUENCY):

The dataset has 98645 observations.

model <- glmer(switch ~ TONE + FREQUENCY + POS + GENDER + GENERATION + 
                                   (TONE|SPEAKER) +
                                   (1|TOKEN),
                           data = can,
                           family = binomial("logit"),
                           control=glmerControl(optimizer="bobyqa", 
                           optCtrl=list(maxfun=2e5),
                           calc.derivs=FALSE), 
                           na.action=na.omit
                          )

Using the DHARMa package, I got the following results, which I'm not sure how to interpret. Especially the residual vs. predicted figure, I've not seen such a pattern in the examples. Is it looking right?

simulationOutput.can <- simulateResiduals(fittedModel = model)
plot(simulationOutput.can)

image

Any suggestion would be appreciated. Thank you!

Hello,

there is nothing to see, your residuals look fine. However, the general plot usually looks good with 0/1 logistic regression.

See comments on the vignette, section on binomial data, https://cran.r-project.org/web/packages/DHARMa/vignettes/DHARMa.html#binomial-data on how to proceed.

Best,
FH

kc-li commented

I see. Thank you for the suggestion!