gavinsimpson / gratia

ggplot-based graphics and useful functions for GAMs fitted using the mgcv package
https://gavinsimpson.github.io/gratia/
Other
202 stars 28 forks source link

quantile residuals as an option to appraise() #97

Open Aariq opened 3 years ago

Aariq commented 3 years ago

It would be nice to have an option to use randomized quantile residuals (i.e. from statmod::qresid()) in appraise(). Maybe this could even be the default for poisson and binomial models? According to the help file for qresid(), "Quantile residuals are the only useful residuals for binomial or Poisson data when the response takes on only a small number of distinct values."

gavinsimpson commented 3 years ago

It's on my TODO list. I'm not sure I agree whole heartedly with the quote; the QQ plot in appraise() takes into account the problem by forming a reference band built from simulating residuals from the fitted model. However, for the other plots of residuals the quote is spot on.

I need to look at how quantile residuals should be created when the model is a location-scale or distributional regression one, but for the standard distirbutions quantiles residuals should be straightforward to add.