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:

  1. First, you need to fit Sqft, Floor, TotalFloor, Bedroom, Living.Room, and Bathroom into a linear regression model:
    > fit <- lm(Price ~ Sqft + Floor + TotalFloor + Bedroom ...

Get R for Data Science Cookbook now with O’Reilly online learning.

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