StatPlay Topics Multiple Regression

Multiple Regression — Beyond Two Variables

Visualize a 3D regression plane for two predictors and see how it scales to three, four, or more variables. Learn what partial slope coefficients actually mean.

M.02 / MULTIPLE REGRESSION

Multiple Regression

Simple regression is one line. But often you want to strip away other effects — the impact of ad spend holding day-of-week and season fixed. That's multiple regression. Add dimensions, and each partial coefficient tells you the effect controlling for everything else.

With two or more explanatory variables, it's multiple regression. Predict y (e.g., test score) from x₁ (study hours) and x₂ (sleep hours), handling several factors at once. Instead of a regression line, you get a regression plane. β₁ is the effect on y of a unit change in x₁ holding x₂ fixed; β₂ is the same for x₂. Set true parameters, generate data, and compare the estimates to the truth. Drag the canvas to rotate and see the plane and data in 3D.
Note: only 2 predictors can be drawn (our eyes top out at 3-D). But the equation keeps going — ŷ = β₀ + β₁x₁ + β₂x₂ + β₃x₃ + … + βkxkyou can add as many variables as you like. From x₃ onward you just "can't draw it", but the estimator β̂ = (XᵀX)⁻¹Xᵀy works exactly the same. In practice, 5–50 predictors is very normal.

ŷ = β₀ + β₁x₁ + β₂x₂ , β̂ = (XᵀX)⁻¹Xᵀy
Drag to rotate
Est. β̂₀
Est. β̂₁
Est. β̂₂