Performing a multiple regression analysis
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.
Getting ready
One needs to have completed the previous recipe by downloading the house rental data into a variable house
.
How to do it…
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 ...
Get R for Data Science Cookbook 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.