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:
The results are shown as follows:
> LModel1Call:lm(formula = medv ~ ., data = BHDataScaled)Coefficients:(Intercept) crim zn indus chas 0.480450 -0.213550 ...