O'Reilly logo

Regression Analysis with R by Giuseppe Ciaburro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Multiple linear model fitting

After carefully analyzing the data, it is time to build the multiple linear regression model to obtain a tool capable of predicting the median value of owner-occupied homes of new observations. To fit the multiple linear regression model, we can use the lm() function. This function is used to fit linear models. It can be used to carry out regression, single stratum analysis of variance, and analysis of covariance.

To fit a multiple linear regression model for the medv response, using all predictors, we can type as follows:

LModel1<-lm(medv~.,data=BHDataScaled)

The results are shown as follows:

> LModel1Call:lm(formula = medv ~ ., data = BHDataScaled)Coefficients:(Intercept)         crim           zn        indus         chas  0.480450 -0.213550 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required