Exploring model results

We previously said that the lm() function creates a LinearModel object, comprising used data, model description, diagnostic information, and fitted coefficients for a linear regression. Now, we will use some of these properties to extract further knowledge from the model.

The values in the lm object depend on the type of model we have built. In this regard, it should be noted that the lm() function can be used to carry out regression, single stratum analysis of variance, and analysis of covariance. To see exactly what a linear model fit produces, try the names function:

names(LModel)

For LModel, the result are shown as follows:

> names(LModel) [1] "coefficients" "residuals" "effects" "rank" "fitted.values" "assign" ...

Get Regression Analysis with R 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.