Learning path

Full curriculum

Full curriculum

Unit content

Multiple linear regression

Multiple linear regression predicts a numerical target from several features at once.

For feature vector $x=(x_1,\ldots,x_d)$, the model is

$$\hat y=\beta_0+\beta_1x_1+\cdots+\beta_dx_d.$$

Using a design matrix $X$ with an added column of ones, this can be written compactly as

$$\hat y=X\beta.$$

Ordinary least squares chooses $\beta$ to minimize

$$|y-X\beta|_2^2.$$

When $X^TX$ is invertible, the solution satisfies the normal equations

$$X^TX\beta=X^Ty.$$

Consider predicting house price from area and age:

$$\hat y=50{,}000+2{,}100,\text{area}-800,\text{age}.$$

Holding age fixed, the area coefficient describes the model's predicted change in price per additional unit of area. This conditional interpretation differs from a simple one-feature regression because the other included predictors are held fixed.

Linear regression is called linear because it is linear in its coefficients. The feature representation itself can contain nonlinear transformations such as $x^2$ or interactions such as $x_1x_2$, provided the prediction remains a linear combination of those features.