Skip to main content

5.6) Useful Functions For Model Objects


plot() for a model object, as we've seen, gives four diagnostic plots of residuals; it should be the first command you use after fitting any model.
abline() We’ve met this before, but here note that it has an argument for model objects so, if you give it one, the intercept and slope will be taken from the first two model coefficients. This is an easy way of adding a modelled regression line to a scatter plot.
summary() presents the main statistics for a model, including t-tests for the significance of each coefficient’s difference from zero.
residuals() extracts the residuals from a model object.
predict() gives a vector of the values that a model would predict. If you only provide the model itself as input, you’ll get the prediction for each of the original data values. If you provide a new data frame with the right column headings as newdata=, you can get predictions for your new data.
AIC() gives the Akaike Information Criterion value for a model.