Knowledge / Statistics / Multiple regression

Multiple regression

Statistics (B.Sc) · Regression and time series · free study notes for exams, placements and interviews

In short

Multiple regression models one dependent variable Y as a linear function of two or more explanatory variables X₁, X₂, …, X_k, so that the effect of each X can be measured while the others are held constant. It is the workhorse of applied statistics: demand estimation, credit scoring, salary and yield models, and almost every "driver analysis" in an analytics job. Indian exams test it heavily — GATE Statistics (ST), IIT JAM MS, UGC NET, Indian Statistical Service (ISS), ICAI/actuarial papers and B.Sc/B.Stat university papers all ask normal equations, partial and multiple correlation, the ANOVA table, t and F tests, and multicollinearity. In placement rounds for Fractal, Mu Sigma, ZS, Tiger Analytics, CRISIL, banks and insurers, the interview almost always opens with regression assumptions, R² versus adjusted R², and what VIF means.

Explained

The model, its terms and its assumptions

Estimation by ordinary least squares

Multiple and partial correlation

Goodness of fit and hypothesis testing

Problems of the data: multicollinearity, heteroscedasticity, autocorrelation

Qualitative regressors, diagnostics and model selection

Key points

Formulas and examples

Model: Y = β₀ + β₁X₁ + … + β_kX_k + u; fitted: Ŷ = b₀ + b₁X₁ + … + b_kX_k. Units of b_j = units of Y per unit of X_j.
Normal equations (k = 2, deviations x = X − X̄, y = Y − Ȳ):
Σx₁y = b₁Σx₁² + b₂Σx₁x₂ ; Σx₂y = b₁Σx₁x₂ + b₂Σx₂² ; b₀ = Ȳ − b₁X̄₁ − b₂X̄₂
b₁ = (Σx₁y·Σx₂² − Σx₂y·Σx₁x₂)/(Σx₁²·Σx₂² − (Σx₁x₂)²) ; b₂ = (Σx₂y·Σx₁² − Σx₁y·Σx₁x₂)/(same denominator)
Matrix form: b = (X′X)⁻¹X′y ; Var(b) = σ²(X′X)⁻¹ ; SE(b_j) = s√c_jj
TSS = RSS + ESS ; R² = RSS/TSS = 1 − ESS/TSS ; RSS = b₁Σx₁y + b₂Σx₂y (deviation form)
Adjusted R² = 1 − (1 − R²)·(n − 1)/(n − k − 1)
F = (RSS/k)/(ESS/(n − k − 1)) with (k, n−k−1) df ; t_j = b_j/SE(b_j) with (n−k−1) df
R²_{Y.12} = (r²_{Y1} + r²_{Y2} − 2r_{Y1}r_{Y2}r_{12})/(1 − r²_{12})
r_{Y1.2} = (r_{Y1} − r_{Y2}r_{12})/√[(1 − r²_{Y2})(1 − r²_{12})]
VIF_j = 1/(1 − R²_j) ; Durbin–Watson d = Σ_{t=2}^{n}(e_t − e_{t−1})²/Σ_{t=1}^{n}e_t²
Beta coefficient β*_j = b_j·s_{Xj}/s_Y (unit-free)

Example 1 — fitting a two-variable regression. Monthly figures for a retail outlet: Y = sales (₹ lakh), X₁ = advertising spend (₹ lakh), X₂ = number of salespersons.

X₁X₂Yx₁x₂y
123−2−1−1
212−1−2−2
344010
435101
556222

Means: X̄₁ = 3, X̄₂ = 3, Ȳ = 4. Sums of squares and products: Σx₁² = 10, Σx₂² = 10, Σx₁x₂ = 8, Σx₁y = 9, Σx₂y = 9, Σy² = 10. Normal equations: 10b₁ + 8b₂ = 9 and 8b₁ + 10b₂ = 9. Subtracting, 2b₁ − 2b₂ = 0 → b₁ = b₂; then 18b₁ = 9 → b₁ = b₂ = 0.5. b₀ = 4 − 0.5(3) − 0.5(3) = 1. Ŷ = 1 + 0.5X₁ + 0.5X₂ — one extra ₹1 lakh of advertising raises expected sales by ₹0.5 lakh, salespersons held constant.

Example 2 — fit, ANOVA and t tests for the same data. RSS = b₁Σx₁y + b₂Σx₂y = 0.5(9) + 0.5(9) = 9; TSS = Σy² = 10; ESS = 1. R² = 9/10 = 0.90; Adjusted R² = 1 − (0.10)(4/2) = 0.80. F = (9/2)/(1/2) = 9.00 on (2, 2) df. F₀.₀₅(2,2) = 19.00, so not significant at 5% — a high R² on n = 5 proves little. s² = ESS/(n−k−1) = 1/2 = 0.5. With (X′X)⁻¹ (deviation part) = (1/36)[[10, −8], [−8, 10]], c₁₁ = 10/36 = 0.2778. SE(b₁) = √(0.5 × 0.2778) = √0.1389 = 0.373; t = 0.5/0.373 = 1.34 on 2 df (t₀.₀₂₅ = 4.303) → not significant. ANOVA table:

SourceSSdfMSF
Regression9.024.509.00
Error1.020.50
Total10.04

Example 3 — correlations, collinearity and the incremental F. From the same sums: r_{Y1} = 9/√(10×10) = 0.9, r_{Y2} = 0.9, r_{12} = 8/10 = 0.8. Check R²: (0.81 + 0.81 − 2×0.9×0.9×0.8)/(1 − 0.64) = (1.62 − 1.296)/0.36 = 0.324/0.36 = 0.90 ✓ (matches Example 2). Partial correlation r_{Y1.2} = (0.9 − 0.9×0.8)/√[(1 − 0.81)(1 − 0.64)] = 0.18/√(0.19 × 0.36) = 0.18/0.2615 = 0.688 — the net association is far weaker than the simple r of 0.9. VIF = 1/(1 − 0.8²) = 1/0.36 = 2.78 (moderate, acceptable). Dropping X₂: b = Σx₁y/Σx₁² = 0.9, RSS₁ = 0.9 × 9 = 8.1, R² = 0.81. Incremental F for adding X₂ = [(1.9 − 1.0)/1]/[1.0/2] = 0.9/0.5 = 1.80 = t² = 1.34² ✓ — X₂ adds nothing beyond X₁ in this sample. Beta coefficients: s_{X1} = s_Y = √(10/4) = 1.5811, so β*₁ = 0.5 × 1.5811/1.5811 = 0.50; same for X₂ — equal relative importance.

Example 4 — prediction. For X₁ = 6 (₹6 lakh ads) and X₂ = 4 salespersons: Ŷ = 1 + 0.5(6) + 0.5(4) = ₹6 lakh. Note X₁ = 6 lies just outside the observed range (1–5), so this is mild extrapolation; the prediction interval would also be wider than the interval for the mean response at the same point.

Example 5 — dummy variable. Fitted starting-salary model from campus data: Ŷ = 18,000 + 1,200·EXP + 2,500·D, where Y = monthly salary in ₹, EXP = years of experience, D = 1 for postgraduate, 0 for graduate (graduate is the base).

StatisticWhat it answersCaution
R²Share of Y-variance explainedRises with every added X
Adjusted R²Same, penalised for kCan be negative
Overall FIs the model as a whole useful?Can be significant when no single t is
t for b_jIs this X useful given the others?Collapses under multicollinearity
Partial FIs this block of X's worth adding?= t² when one variable
VIFCollinearity burden on b_j> 5 warning, > 10 serious

Where it is used

Interview questions

Common mistakes

Related topics

Correlation and regression · Time series analysis · Index numbers · Analysis of variance and design of experiments · Testing of hypotheses · Logistic regression and generalised linear models

Open in the Knowledge reader →Find jobs →