Multiple Linear Regression Example
Multiple Linear Regression Example
Multiple Linear Regression is a statistical technique used to model the relationship between
one dependent variable and two or more independent variables. It extends simple linear
regression by allowing for multiple predictors, providing a more nuanced understanding of
the relationship between variables.
Key Concepts:
Dependent Variable (Y): The variable we are trying to predict or explain.
Independent Variables (X₁, X₂, ... Xₖ): The variables that are used to predict the
dependent variable.
Y = β0 + β1 X1 + β2 X2 + ... + βk Xk + ϵ
Where:
Number of bedrooms: X2
1/3
Price of House = β0 + β1 ⋅ Size + β2 ⋅ Bedrooms + β3 ⋅ Age + β4 ⋅ Distance + ϵ
1. Data Collection: Gather data for the price of houses, including all the independent
variables (size, number of bedrooms, age, distance).
2. Model Fitting: Use a training dataset to find the best values for β0 , β1 , β2 , β3 , β4 that
3. Prediction: Once the model is trained, you can predict the house price by plugging in
values for the independent variables.
4. Evaluation: Assess the performance of the model using metrics like Mean Squared Error
(MSE), R-squared, etc.
Example Data:
Size (sq ft) Bedrooms Age (years) Distance (km) Price (in $1000)
2000 3 10 5 300
1500 2 15 8 250
2500 4 5 3 400
1800 3 8 6 280
2200 3 12 4 350
Model Training:
The model will use this data to determine the coefficients β0 , β1 , β2 , β3 , β4 . For example,
Prediction:
For a house of size 1800 sq ft, with 3 bedrooms, 10 years old, and 5 km away from the city
center:
\text{Predicted Price} = 50 + 0.1 \cdot 1800 + 5 \cdot 3 - 1.2 \cdot 10 - 2.5 \cdot 5 = 50 + 180 +
15 - 12 - 12.5 = 220.5 \text{ (in $1000)}
2/3
Summary:
Multiple Linear Regression allows you to model the relationship between multiple predictors
and a target variable. It is widely used for tasks like predicting house prices, sales, or any
other outcome that depends on several factors.
3/3