Variable Relationships › Multiple Linear Regression: Multiple Predictors

Michael BrenndoerferJune 3, 20253 min read
Machine Learning from ScratchAll chapters
Part 1 of 9Statistics 101
Chapter 6Variable Relationships › Multiple Linear Regression: Multiple Predictors
Reading section 6 of 11 · Multiple Linear Regression: Multiple Predictors · 3 minSection 6 of 11 · 3 min

Book contents

Section 6 of 11 · 3 min read

Variable Relationships › Multiple Linear Regression: Multiple PredictorsOne section · Sections in this chapter6 / 11 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Real-world phenomena typically depend on multiple factors rather than a single predictor. Multiple linear regression extends simple regression to model the relationship between a dependent variable and multiple independent variables simultaneously. This approach allows us to estimate the effect of each predictor while controlling for the others.

The multiple linear regression model is:

Y=β0+β1X1+β2X2+⋯+βpXp+ϵY = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \cdots + \beta_p X_p + \epsilon

Where:

  • YY: Dependent variable
  • X1,X2,…,XpX_1, X_2, \ldots, X_p: Independent variables (predictors)
  • β0\beta_0: Intercept
  • β1,β2,…,βp\beta_1, \beta_2, \ldots, \beta_p: Regression coefficients
  • ϵ\epsilon: Error term

Each coefficient βj\beta_j represents the expected change in YY for a one-unit change in XjX_j, holding all other predictors constant. This "holding constant" interpretation is important: it means we're estimating the partial effect of each variable, adjusting for the influence of other variables in the model. This capability makes multiple regression particularly useful for disentangling the effects of correlated predictors.

In matrix notation, the model can be written compactly as Y=Xβ+ϵ\mathbf{Y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\epsilon}, and the OLS solution is β^=(XTX)−1XTY\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{Y}. This formulation reveals the mathematical elegance of regression and enables efficient computational implementation.

While multiple regression with many predictors is difficult to visualize fully, we can illustrate the concept with two predictors. The regression model fits a plane through three-dimensional space, predicting Y from both X₁ and X₂.

Out[7]:
Visualization
3D scatter plot with fitted regression plane showing multiple regression.
Multiple regression with two predictors visualized as a 3D surface. The blue points represent observed data in three-dimensional space (X₁, X₂, Y), while the red surface shows the fitted regression plane. The plane represents the model's predictions across all combinations of X₁ and X₂ values. This visualization demonstrates how multiple regression extends the concept of a line to higher dimensions, enabling prediction from multiple variables simultaneously.