What is linear regression?

Linear regression describes a relationship between a response variable and one or more predictor variables using a function that is linear in its coefficients. In the simplest case, it fits a straight line. Ordinary least squares chooses the coefficients that minimize the sum of squared residuals: the differences between observed and fitted responses.

Read the line in the units of the variables

A predictor is an input used to describe the response, the quantity being modeled. For one predictor x, the fitted line is ŷ = a + bx. The hat on ŷ means fitted value; a is the intercept, the fitted response at x = 0. The slope b is the change in fitted y for a one-unit increase in x, measured in response units per predictor unit. If zero lies outside the observed range, the intercept need not have a useful practical interpretation.

Linear refers to the coefficients, such as a and b. A model can include a squared predictor and still be linear in its coefficients. The paired lesson uses only a straight line with one predictor.

A residual describes a gap in the observed sample

A residual is observed y minus fitted ŷ. A positive residual puts an observation above the line; a negative one puts it below. Squaring prevents positive and negative gaps from canceling and gives larger gaps more weight. A small sum of squared residuals describes fit to these observations, not demonstrated accuracy on new data.

Association needs a separate causal argument

Correlation summarizes linear association without assigning response and predictor roles. Regression specifies those roles and gives a fitted relationship in their units. Neither operation alone shows what would happen if someone intervened to change x. An omitted common cause, reverse direction of influence or how observations were selected can produce an association.

Causal identification means justifying a causal effect from the study design and explicit assumptions. Adding predictors is not automatically such a justification. Inspect the data and design before interpreting a fitted coefficient as an effect.

Frequently asked questions

Does least squares require normally distributed observations to calculate a line?

No. The arithmetic fit can be computed without normality when the predictor values are not all identical. Confidence intervals and tests for population coefficients require additional sampling and error assumptions; the act of fitting does not verify them.

Can I extend the line beyond the observed predictor values?

You can calculate such a value, but this is extrapolation. The fitted relationship may fail outside the observed range. Calculation alone supplies no evidence that the extension is reliable.

Does a zero slope prove there is no relationship?

No. A straight-line slope can miss a curved relationship. The chosen functional form and the actual observations need examination.

Learn this in the Academy

See it on a ticker

Browse all S&P 500 tickers to see this metric applied to individual companies.

Related terms

Educational research only — not investment advice.