11/15/23, 1:21 AM
17.6. Multiple Regression — Computational and Inferential Thinking
https://inferentialthinking.com/chapters/17/6/Multiple_Regression.html
1/12
Multiple Regression
Contents
17.6.1. Home Prices
17.6.2. Multiple Linear Regression
17.6.3. Nearest Neighbors for Regression
Now that we have explored ways to use multiple attributes to predict a categorical variable, let
us return to predicting a quantitative variable. Predicting a numerical quantity is called
regression, and a commonly used method to use multiple attributes for regression is called
multiple linear regression
.
17.6.1. Home Prices
The following dataset of house prices and attributes was collected over several years for the city
of Ames, Iowa. A
description of the dataset appears online
. We will focus only a subset of the
columns. We will try to predict the sale price column from the other columns.
all_sales
=
Table
.
read_table(path_data
+ 'house.csv'
)
sales
=
all_sales
.
where(
'Bldg Type'
,
'1Fam'
)
.
where(
'Sale Condition'
,
'Normal'
)
.
select(
'SalePrice'
,
'1st Flr SF'
,
'2nd Flr SF'
,
'Total Bsmt SF'
,
'Garage Area'
,
'Wood Deck SF'
,
'Open Porch SF'
,
'Lot Area'
,
'Year Built'
,
'Yr Sold'
)
sales
.
sort(
'SalePrice'
)
Skip to main content