Linear Regression
- Category
- Quantitative Finance
- Level
- Professional
Simple definition
Drawing the single straight line that comes closest to a cloud of points, then using its slope to describe how one quantity moves with another.
Professional definition
Estimating a linear relation between a dependent variable and one or more explanatory variables by minimising the sum of squared residuals. The slope is the covariance of the two series divided by the variance of the explanatory one, and the intercept is whatever makes the line pass through the point of means.
Technical definition
Ordinary least squares projects the dependent variable onto the space spanned by the regressors. The estimator is unbiased and minimum-variance among linear unbiased estimators only under the Gauss-Markov conditions, which financial time series routinely break through autocorrelation, heteroskedasticity and non-stationarity. The fit remains computable when those conditions fail; the standard errors and t statistics do not remain valid.
Academic definition
The least-squares projection of a response variable onto the linear span of a set of regressors, yielding coefficient estimators that are best linear unbiased under the Gauss-Markov assumptions.
Mechanism
Least squares penalises each miss by its square, so the fitted line is pulled hardest by the points furthest from it. That is what makes it efficient under well-behaved noise and fragile under outliers: a single crisis observation can set the slope for an entire sample, and the line will still look like a summary of the whole period.
In practice
- Who uses it
- Anyone estimating a beta, a hedge ratio, a factor exposure or a cointegrating relationship, and every machine-learning pipeline that starts with a linear baseline.
- Why it matters
- It gives a single interpretable number for how two series co-move, with a ready-made framework for testing whether that number is distinguishable from zero.
- Limitations
- The coefficients describe the sample fitted, not a mechanism. On non-stationary series the estimated slope can be entirely an artefact of two unrelated trends.
Common mistakes
- Reading a significant slope as evidence that one series causes the other.
- Using default standard errors on autocorrelated residuals.
- Extrapolating a fitted line far outside the range of the data.
Examples
Five paired observations with x running 1 to 5 and y of 2, 4, 5, 4, 6. The deviation products sum to 8 and the squared x deviations to 10, so the slope is 0.8 and the intercept 1.8.
- x: 1, 2, 3, 4, 5 with mean 3
- y: 2, 4, 5, 4, 6 with mean 4.2
- n = 5
- sum of (x - 3)(y - 4.2) = 4.4 + 0.2 + 0 - 0.2 + 3.6 = 8.0
- sum of (x - 3)^2 = 4 + 1 + 0 + 1 + 4 = 10
- slope = 8.0 / 10 = 0.8
- intercept = 4.2 - 0.8 x 3 = 1.8
- fitted values: 2.6, 3.4, 4.2, 5.0, 5.8
- residuals: -0.6, 0.6, 0.8, -1.0, 0.2; sum of squares = 2.4
Verified numerically. With five observations the slope has one degree of freedom's worth of support; nothing about its statistical reliability follows from the fit alone.
Regressing a stock's returns on an index's returns gives a beta as the slope. Change the sample window or the return frequency and the beta changes, because it is an estimate from one window rather than a property of the stock.
Mathematical foundation
Variables
| \hat{\beta}_1 | Estimated slope: the covariance of x and y divided by the variance of x | units of y per unit of x |
| \hat{\beta}_0 | Estimated intercept: the fitted value where x is zero | units of y |
| \varepsilon_i | Error term: everything in y the line does not explain | units of y |
| \bar{x}, \bar{y} | Sample means; the fitted line always passes through this point | respective units |
Procedure
Align the two series. Compute both means. Form the deviation products and the squared x deviations, sum each, and divide to get the slope. Put the slope and the two means into the intercept formula. Then compute the residuals and inspect them: if they show trend, autocorrelation or changing spread, the fit may stand but the inference built on it does not.
Worked example
- x: 1, 2, 3, 4, 5
- y: 2, 4, 5, 4, 6
- x-bar = 3, y-bar = 4.2
- sum (x-x-bar)(y-y-bar) = 8.0
- sum (x-x-bar)^2 = 10
- slope = 8.0/10 = 0.8
- intercept = 4.2 - 0.8(3) = 1.8
- residual sum of squares = 2.4; total sum of squares = 8.8
Interpretation
The slope says how much y moved per unit of x inside this sample, holding the other regressors fixed if there are any. It is a description of co-movement, not a causal claim and not a forecast: both of those require evidence the regression itself cannot supply.
Assumptions
- The relation is linear in the parameters, the errors have zero conditional mean, constant variance and no serial correlation, and the regressors are not perfectly collinear.
- Financial time series commonly violate constant error variance and zero serial correlation, so default standard errors, t statistics and p values from such a regression are understated in reliability even when the coefficients themselves are informative.
- Non-stationary inputs can produce a strongly significant slope between unrelated series, which is why differencing or a cointegration test comes before interpretation.
- Least squares is not robust: one extreme observation can determine the slope of a long sample.
- A regression fitted on history has no built-in out-of-sample guarantee, and adding regressors always improves the in-sample fit whether or not they carry information.
Related terminology
- related
- R-squared Covariance Correlation Beta Capital Asset Pricing Model Hypothesis Testing p-value Confidence Interval Overfitting Stationarity Autocorrelation Hedge Ratio Cointegration
Correlation
Correlation is symmetric and unit-free; regression is directional and keeps units. Swapping x and y leaves the correlation unchanged but generally changes the slope.
Sources
Editorial status
Written, not yet reviewed.
