Multiple regression analysis can be regarded as an extension of simple linear regression. One can use multiple regression analysis to predict the value of a dependent variable based on multiple independent variables. In the following recipe, we demonstrate how to predict house rental prices with multiple variables.
One needs to have completed the previous recipe by downloading the house rental data into a variable house
.
Perform the following steps to fit the house rental dataset into a multiple regression model:
First, you need to fit
Sqft
,Floor
,TotalFloor
,Bedroom
,Living.Room
, andBathroom
into a linear regression model:> fit <- lm(Price ~ Sqft + Floor + TotalFloor + Bedroom + Living.Room + Bathroom, data=house)
Obtain the summary of the fitted model:
> summary(fit) Call: lm(formula = Price ~ Sqft + Floor + TotalFloor + Bedroom + Living.Room + Bathroom, data = house) Residuals: Min 1Q Median 3Q...