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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.