Lesson 3.2 · 8 min read · about 55 min to master at a very slow pace
Simple and Multiple Linear Regression
One predictor or many, the model is a weighted sum of inputs. Why a model with X² or interaction terms is still "linear" regression: it only has to be linear in the coefficients.
Simple linear regression
One predictor:
is the intercept (the predicted when ) and the slope (the change in predicted per one-unit increase in ). The fitted model is a straight line.
Multiple linear regression
Several predictors:
With two predictors the fitted model is a plane in 3-D space; with more it is a hyperplane. The algebra is identical, it just can't be drawn. It's a parametric model: a finite list of coefficients.
"Linear" means linear in the coefficients
This surprises almost everyone. The model below is still linear regression:
The curve is a parabola, but the unknowns each appear on their own, multiplied by a known number and added up. Create a new column and it becomes an ordinary multiple regression with two predictors. The same fitting method (OLS) works unchanged.
Interactions are linear too
is just another column computed from the data. The interaction lets the effect of depend on : the slope for is .
| Model | Linear regression? | Why |
|---|---|---|
| Yes | Each multiplies a known column | |
| Yes | is a known column | |
| Yes | is a known column | |
| No | sits inside an exponential | |
| No | is an exponent |
Test
Treat the data as fixed numbers. If the model is a sum of (coefficient × something computed from the data), it is linear regression, however curved the picture.
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
First passWhy is still called linear regression when is squared?
Because "linear" refers to the coefficients, not the inputs. is computed from the data, so it's a known number for every row. The model is : each unknown multiplies a known value, and the terms are added. Treat as a second predictor column and it's an ordinary multiple regression.
First passWhy is a model with an interaction term still linear regression?
Same reason: is a column you can compute from the data before fitting. The model is still a weighted sum with unknown weights , so OLS fits it exactly as before.
First passWhat does "linear in the coefficients" mean?
The unknown parameters appear only to the first power, each multiplied by something known, and the pieces are added. The inputs themselves can be transformed in any way (squared, logged, multiplied together). A model like is not linear in its coefficients, because is inside the exponential.
Cheatsheet
Multiple linear regression
"Linear" regression
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.