Ordinary Least Squares (OLS)
The workhorse linear estimator, derived in matrix form, with its geometry, the Gauss-Markov optimality result, its sampling distribution, and the assumptions that break in financial data.
Prerequisites: Linear Algebra for Quants, Expectation, Variance & Moments
Ordinary least squares is the most-used estimator in quantitative finance, factor models, hedge ratios, beta estimation, and most linear signals are OLS underneath. It is worth understanding not as a black box but from its geometry and its optimality theorem, because the places OLS fails are exactly the places financial data lives.
The model
We observe paired observations of an outcome and a -vector of regressors , and assume a linear conditional mean:
Stacking rows gives the matrix form , where , (the design matrix, typically with a column of ones for the intercept), is the parameter we want, and is the unobserved error.
OLS chooses to minimize the residual sum of squares:
Deriving the estimator
The objective is convex in . Expanding,
Setting the gradient to zero gives the normal equations:
If has full column rank, is invertible and
The Hessian is positive semidefinite (and positive definite under full rank), confirming a global minimum.
The geometry: projection
The fitted values are , where is the hat matrix. is the orthogonal projection onto the column space of : it is symmetric () and idempotent (). So OLS decomposes into the part explained by (its projection ) and an orthogonal residual . Orthogonality, , is the normal equations, the residual is uncorrelated with every regressor by construction. This is the single most useful mental image of regression: least squares is projection.
The Gauss-Markov assumptions
The estimator above is mechanical; its statistical properties require assumptions.
- Linearity: with fixed.
- Strict exogeneity: . This is the load-bearing assumption, it delivers unbiasedness and is what "no omitted variables, no reverse causality, no measurement error in " really means.
- No perfect multicollinearity: has full column rank .
- Spherical errors: , errors are homoskedastic and uncorrelated.
Assumptions 1–3 give unbiasedness; adding 4 gives efficiency.
Properties
Unbiasedness. Substituting ,
Taking expectations conditional on and using strict exogeneity, .
Variance. From the same expression,
The unknown is estimated unbiasedly by ; the denominator (degrees of freedom) corrects for the parameters already fit.
Gauss-Markov (optimality). Among all linear, unbiased estimators, OLS has the smallest variance, it is BLUE (Best Linear Unbiased Estimator). Note what this does not say: it says nothing about nonlinear estimators, and under fat tails or heteroskedasticity a biased estimator (ridge) or a robust one can beat OLS in mean-squared error. See The Gauss–Markov Theorem.
Inference
Add normality, , and is exactly Gaussian:
The -statistic for a coefficient, , follows a distribution, giving hypothesis tests and confidence intervals. Even without normality, the CLT delivers asymptotic normality, so these tests hold approximately in large samples.
Goodness of fit
is the fraction of variance explained. Two warnings that matter in practice: never decreases when you add regressors (use adjusted , which penalizes ), and a high is neither necessary nor sufficient for a good model, a tiny is normal and often tradeable in cross-sectional return regressions.
Worked example: estimating beta
Regress a stock's excess returns on the market's excess returns : . Here the slope has the closed form
If the sample covariance is and the market variance is , then , the stock moves per market move on average. The intercept is the sample estimate of Jensen's Alpha (α). This single-regressor case shows the general truth: OLS slopes are (co)variance ratios.
Failure modes in financial data
This is where quants earn their keep, every Gauss-Markov assumption is routinely violated by markets:
- Heteroskedasticity. Volatility clusters, so is not constant. stays unbiased but the standard errors are wrong; use White/robust standard errors. See Heteroskedasticity.
- Autocorrelation. Overlapping returns and momentum induce serially correlated errors, again invalidating naive standard errors (use Newey-West). See Autocorrelation and Serial Correlation.
- Multicollinearity. Correlated factors (value and size, say) make near-singular, inflating and making coefficients unstable and sign-flippy. See Multicollinearity.
- Endogeneity. If a regressor is correlated with the error, omitted variables, simultaneity, or noisy predictors, strict exogeneity fails and is biased and inconsistent, no sample size saves it. This is the deepest problem and motivates instrumental variables.
- Outliers and fat tails. Squared loss weights large residuals heavily, so a few extreme return days can dominate the fit; robust regression or winsorization helps.
- Overfitting with many regressors. As grows relative to , in-sample rises mechanically while out-of-sample performance collapses, the motivation for Ridge and LASSO Regularization.
In interviews
Expect to derive from the normal equations, explain why strict exogeneity (not just zero-mean errors) is what you need for unbiasedness, state Gauss-Markov precisely (linear and unbiased, candidates who drop "linear" are wrong), and identify which failures bias the point estimate (endogeneity) versus only the standard errors (heteroskedasticity, autocorrelation). A common follow-up: "when would you not use OLS?", the honest answer names regularization for high-dimensional or collinear designs and robust methods for fat tails.
Related concepts
Practice in interviews
Further reading
- Hayashi, Econometrics (Ch. 1)
- Greene, Econometric Analysis
- Hastie, Tibshirani & Friedman, The Elements of Statistical Learning (Ch. 3)