Multiple Linear Regression (MLR)
Multiple Linear Regression (MLR)
🔹 Introduction
Multiple Linear Regression is an extension of simple linear regression where:
👉 We use more than one input variable (feature) to predict a single continuous output.
It models the relationship between one dependent variable and two or more independent variables
In real-world problems the response variable is often influenced by multiple predictors
🔹 Problem Formulation
Given dataset:
- → output
🔹 Model Representation (Hypothesis)
Where:
- → intercept
- → coefficient of feature
👉 This is a linear combination of inputs
🔹Example
📌 House Price Prediction
Features:
- → area
- → number of rooms
- → location score
Model:
🔹Objective Function
We minimize squared error:
👉 Same as simple regression but with multiple variables
🔹Dataset Representation
Assume:
- observations
- features
📌 Feature Matrix (size
📌 Response Vector
🔹 Regression Model
For features:
🔹 Matrix Form (Very Important)
Add a column of 1s for intercept:
📌 Parameter Vector
📌 Model Equation
🔹 Least Squares Solution
We estimate parameters using:
👉 This is called the Normal Equation
🔹 Final Prediction
🔹 Important Notes
- Requires all data in memory
- Uses matrix operations
- Efficient for small to medium datasets
🔹 How It Works (Step-by-Step)
- Represent data in matrix form
- Define hypothesis
- Compute error (MSE)
- Minimize error
- Estimate coefficients
🔹 Geometric Interpretation
- 1 variable → line
- 2 variables → plane
- many variables → hyperplane
🔹Assumptions
- Linearity
- Independence of errors
- Constant variance (Homoscedasticity)
- No multicollinearity
- Normal distribution of errors
🔹 Applications
📊 Real-world examples:
- House price prediction
- Stock price prediction
- Medical diagnosis
- Sales forecasting
- Risk analysis
🔹Advantages
- Handles multiple factors
- More accurate than simple regression
- Interpretable coefficients
🔹 Limitations
- Sensitive to multicollinearity
- Assumes linear relationship
- Can overfit with many features
🔹 Comparison
| Feature | Simple LR | Multiple LR |
|---|---|---|
| Inputs | One | Multiple |
| Model | Line | Plane/Hyperplane |
| Complexity | Low | Higher |
📘 Worked Example
🔹 Given Data
| 1 | 1 | 3.25 |
| 1 | 2 | 6.5 |
| 2 | 2 | 3.5 |
| 0 | 1 | 5 |
🔹 Step 1: Construct Matrix
🔹 Step 2: Compute
🔹 Step 3: Compute Inverse
🔹 Step 4: Compute
🔹 Step 5: Compute Coefficients
✅ Final Regression Model
📝 Summary (Quick Revision)
👉 Real-world problems depend on multiple variables, so:
Multiple regression is more practical than simple regression
- Model:
- Solution:
- Prediction:
Comments
Post a Comment