# Why residual plots are used for diagnostic of glm

I asked this question here which @Glen_b had kindly answered. I thought I could get a more detailed explanation with references if I posted it as a whole new question.

So my questions is why residuals plots such as residual vs fitted plot and normal QQ normal can be used for diagnostic of glm? Residuals vs fitted are used for OLS to checked for heterogeneity of residuals and normal qq plot is used to check normality of residuals. However there is no such assumption for glm (e.g. gamma, poisson and negative binomial). So why are these plot still being used to diagnose glm? There are questions (1,2 and etc.) that discussed its usage but the did not explain the reason for their relevance. There is even a command glm.diag.plots from R package boot that provides residuals plots for glm.

Here are some plots from my current analysis. I am trying to select a model among the three: OLS, lognormal OLS and gamma with log link. Perhaps it will be easier to discuss using these plots as examples.

Linear model

lognormal linear model

• See my answer here: stats.stackexchange.com/questions/295340/… – kjetil b halvorsen Oct 10 '17 at 15:50
• Note that the normal QQ plot has the expected order statistics on the x-axis and the ordered residuals on the y-axis -- some of your other plots reverse this convention, making the comparison difficult – Glen_b Oct 11 '17 at 1:56
• @Glen_b I have added the Normal QQ plot that has the expected order statistics on the x-axis and the ordered residuals on the y-axis for gamma glm. The same is similar (perhaps the same) as the QQ plot with swapped axis. – tatami Oct 11 '17 at 15:55
• Your log-link gamma glm plot labels show the expected order statistics on the y axis not the x-axis – Glen_b Oct 12 '17 at 1:40
• @Glen_b log-link gamma glm plot with expected order statistics on x-axis can be found in the center of last row of plots – tatami Oct 12 '17 at 3:02

These plots should be used with caution with non-normal GLMs. My general recommendation is not to look at them if you aren't fitting an OLS regression model (see: Interpretation of plot (glm.model)). For example, why assess whether the residuals are normally distributed when they aren't necessarily supposed to be?

With respect to your specific plots / models, the predictions look pretty far off except for the OLS model. The OLS model seems to have some problems with heteroscedasticity and non-normality of the residuals. I tend to be somewhat skeptical of 'model selection', and I would advise against fitting a bunch of different models and selecting the one with the nicest looking plots. You should start with an understanding of your data and your situation. For instance, it looks like your response is never negative. What is it? Asking (and answering) questions like that should guide you towards the model you want to use.

• To answer your question, it is a health financial data. It is highly right skewed. My sample is more than 400k with trivial number of zeros (0.01%) which I dropped. Skewness is about 90 and kurtosis is about 180. – tatami Oct 11 '17 at 2:01
• "With respect to your specific plots / models, the predictions look pretty far off except for the OLS model." May I know if this is base on the residual vs fitted plot? – tatami Oct 12 '17 at 8:41
• @tatami, yes I notice it in, eg, the lognormal residuals vs fitted plot. When the predicted values are larger, the residuals are all highly negative. That means that your model is completely missing where the data are in that region. It's possible that by examining some residual vs X plots, you could find somewhere to add a squared term to help out. – gung - Reinstate Monica Oct 12 '17 at 11:53
• If the model is correct, the deviance residuals (as used in the Q-Q plot) are often quite close to normally distributed; while you shouldn't expect a perfect line, strong deviations from it at least suggests an issue. It's worth trying it for simulated examples from a number of GLMs to at least get a sense of how far off you can tend to get. For the gamma and the Poisson (as long as the mean doesn't jam right down near 0) it's often surprisingly close. On 0-1 data ... sometimes not so much. See the analysis here – Glen_b Oct 17 '17 at 8:36