Statistics for quants

Linear regression — the quant workhorse

4 min

Linear regression fits the best straight line through a cloud of points, expressing one variable as a weighted sum of others plus an error term:

y = b0 + b1*x1 + b2*x2 + ... + error

It is the most-used model in all of quant finance, and ForecastingStocks itself uses linear regression for its short-horizon forecasts alongside its deep-learning model.

What the pieces mean

  • b0 — the intercept, the value of y when all inputs are zero.
  • b1, b2, ... — the coefficients, how much y changes per unit of each input.
  • error — everything the line cannot explain.

The fit is found by minimising the sum of squared errors — ordinary least squares (OLS).

Reading a regression honestly

  • R-squared tells you the fraction of variance the model explains, from 0 to 1. In finance, a daily-return R-squared of even 0.05 can be tradeable; do not expect the 0.9 values seen in physics.
  • Statistical significance (the p-value of a coefficient) tells you whether a relationship is likely real or just noise in this sample.

The famous example: beta

Regressing a stock's returns on the market's returns gives a slope called beta — how much the stock moves for a 1 percent market move. Beta above 1 means amplified market moves; below 1, dampened. This single regression underlies the Capital Asset Pricing Model and most factor models that follow.

The danger

A regression with enough inputs will fit any in-sample data beautifully and predict the future terribly. Each extra variable buys in-sample fit at the cost of out-of-sample reliability. That tension — fit versus generalisation — is the theme of this entire track.

Finished reading?
Risk disclaimer

This content is for educational and informational purposes only and is not investment, financial, tax or legal advice. Trading and investing carry risk, including the possible loss of capital. Any performance shown by third-party tools is hypothetical and not a promise of future results. Do your own research and consider professional advice before making any decision.