21. Model Diagnostics

Building a model can be a never ending process in which we constantly improve the model by adding interactions, taking away variables, doing transformations and so on. However, at some point we need to confirm that we have the best model at the time, or even a good model. That leads to the question: How do we judge the quality of a model? In almost all cases the answer has to be: in relation to other models. This could be an analysis of residuals, the results of an ANOVA test, a Wald test, drop-in deviance, the AIC or BIC score, cross-validation error or bootstrapping.

21.1 Residuals

One of the first-taught ways of assessing model quality is an analysis of the residuals, which is the difference between the actual response ...

Get R for Everyone: Advanced Analytics and Graphics, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.