Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHARMa residual plots - no quantile lines in the residual plots #75

Closed
florianhartig opened this issue Jun 19, 2018 · 4 comments
Closed

Comments

@florianhartig
Copy link
Owner

Question from a user:

we are trying to model a binary response variable using a mixed effects logistic model fit with glmer. We have continuous and categorical predictors, and we have about 8000+ observations.

I have to say that I am completely puzzled by the shape of the residuals.

image

My understanding is that in the right plot, there should be 3 regression lines/curves representing the first, second, and third quartiles. In the plot that is attached, however, there seems to be only 2: one flat line at 0.5, and one dashed curve which is all over the place. Would you be able to provide some insight into what the dashed line is supposed to represent here?

@florianhartig
Copy link
Owner Author

Hi, this is expected behavior - the default of the plot function is to do the quantile regression for n <= 2000, and for larger datasets a nonparametric smoother, because the quantile regressions can take a long time to calculate. You can overwrite this if you want. Example

library(DHARMa)

testData = createData(sampleSize = 2200, family = poisson(), 
                      randomEffectVariance = 0, numGroups = 5)
fittedModel <- glm(observedResponse ~ Environment1, 
                   family = "poisson", data = testData)
simulationOutput <- simulateResiduals(fittedModel = fittedModel)

plot(simulationOutput) # default switches to quanreg = F for n > 2000 
plot(simulationOutput, quantreg = T) # overrule default

side note: with so many data points, and binomial, it would be useful to think about if you can group your data in some way, using the new recalculateResiduals() function in DHARMa 0.2.0

@florianhartig
Copy link
Owner Author

OK, but I just had a look, the switch of the quantreg is not properly documented in the help. I should improve the help for plotResiduals()

@jeychenne
Copy link

Thanks a lot for your answer. quantreg=T is the bit I was missing.
Regards,
Julien

@florianhartig
Copy link
Owner Author

Great. I'm keeping this open as reminder to update the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants