Multiple Linear Regression
Multiple linear regression models a numerical target with several predictors. Matrix-form OLS, R-squared, the F-test, and multicollinearity.
5 min read · Updated August 8, 2026
Multiple linear regression (MLR) extends simple linear regression to several predictors: the target is modeled as a weighted sum of the inputs plus an intercept. It is the workhorse of applied statistics — interpretable, fast, and the baseline against which fancier regressors are measured.
The model in matrix form
With predictors and observations, the model is:
Stacking all observations into a matrix (with a leading column of ones for the intercept) and the targets into a vector , MLR is fit by ordinary least squares: choose to minimize the sum of squared errors . The solution is the normal equations in matrix form:
Each fitted coefficient is the expected change in per unit change in , holding all other predictors constant — that conditioning is what distinguishes MLR from running separate simple regressions.
MLR rests on several assumptions: the errors are independent, normally distributed with zero mean, and have constant variance (homoscedasticity). When the assumptions hold, the OLS estimators are unbiased (right on average), efficient (lowest variance among linear unbiased estimators), and consistent (they converge to the truth as grows).
How good is the model?
, the coefficient of determination, is the proportion of variance in the target that the model explains, computed from the sums-of-squares terms:
If the model is perfect, and ; if it is useless, and . Keep in mind that a high says nothing about causation — and that never decreases when you add a predictor, even a useless one. The adjusted corrects for that by penalizing model size:
How significant is the model?
The F-ratio tests the whole model against the null hypothesis that every slope is zero, using the mean-squared terms from the ANOVA decomposition ():
Unlike , the F-ratio accounts for sample size and predictor count, so a model can have a high and still fail this test — the classic small-, many- trap. For the worked example: , so on degrees of freedom.
If the model is significant overall, a t-test on each coefficient, , tells you which individual predictors are pulling weight.
Multicollinearity
A high degree of correlation among the predictors makes coefficient estimates unreliable. Warning signs:
- High pairwise correlations between predictors.
- Coefficients whose signs or magnitudes make no physical sense.
- Statistically nonsignificant coefficients on predictors you know are important.
- Coefficients that swing wildly when a predictor is added or removed.
The Variance Inflation Factor (VIF) — from the diagonal of the matrix — quantifies how much each coefficient’s variance is inflated by correlation with the other predictors. A VIF above 5 (some texts say 10) signals a problem; drop, combine, or regularize the offending variables.
Model selection
Dropping predictors that do not contribute is almost always wise: it reduces average prediction error, stabilizes the remaining coefficients, and yields a simpler, more interpretable model. The two classic strategies are forward selection (enter the best predictor one at a time until nothing significant remains) and backward elimination (start with everything and remove the worst predictor one at a time). Both are greedy; modern practice often replaces them with regularization (ridge, lasso), which shrinks weak coefficients toward zero continuously.
In practice
sklearn.linear_model.LinearRegression fits MLR directly; statsmodels.OLS gives the full inferential apparatus — t-tests, F-test, VIF via statsmodels.stats.outliers_influence.variance_inflation_factor. When multicollinearity bites, Ridge stabilizes coefficients; when you want selection, Lasso drives weak coefficients to exactly zero. Always compare nested models on adjusted or cross-validated error, never raw .
Common pitfalls
- Comparing models by raw — it rewards every added variable; use adjusted or holdout error.
- Ignoring VIF and interpreting unstable coefficients as if they were precise.
- Extrapolating outside the region the data covers, where the linear combination has never been tested.
- Skipping residual diagnostics — non-constant variance and curved patterns invalidate the inference.
- Overfitting small samples: with barely larger than , the model memorizes rather than learns.
Summary
Multiple linear regression fits by ordinary least squares, giving each coefficient a “holding others constant” interpretation. Judge the model with , adjusted , and the F-test; judge each predictor with t-tests; and police multicollinearity with VIF. When in doubt, prefer the smaller model.