The p Greater Than n Regime
When you have more candidate features than observations, ordinary regression doesn't just get noisier — it stops having a unique answer at all, and that changes everything about how you have to estimate.
Prerequisites: The Curse of Dimensionality, High-Dimensional Mean Testing When p Exceeds n
Suppose someone asks you to draw the one true straight line through a single data point. You can't — a line has two degrees of freedom (a slope and an intercept), and one point isn't enough to pin both down; infinitely many different lines pass through it exactly. Give them a second point and, generically, exactly one line fits both. This isn't really about lines specifically — it's about having fewer independent facts than unknowns. When the number of candidate predictor variables exceeds the number of observations , you're in exactly this situation, just scaled up: you're trying to determine regression coefficients from only rows of data, and when there are infinitely many combinations of coefficients that fit the data perfectly. This is the "p greater than n" regime, and it is a qualitatively different problem from ordinary small-sample noise — it's not that the answer is uncertain, it's that there is no unique answer to be uncertain about, without bringing in extra assumptions from outside the data.
Why it breaks, one symbol at a time
Ordinary least squares solves for coefficients by minimizing squared error, and the closed-form solution requires inverting the matrix , where is the matrix of predictor values:
In words: the fitted coefficients come from "undoing" the predictor-to-predictor relationships captured in and applying that to how the predictors relate to the target . The matrix is , and its rank can never exceed — a basic fact about matrices built by multiplying an matrix by its own transpose. When , the rank of is at most , strictly less than , which means is singular — not invertible — and simply does not exist. The regression doesn't have one right answer with some uncertainty around it; it has an entire subspace of solutions that all achieve exactly zero training error, and nothing in the data itself picks among them.
Worked example 1: an explicitly singular matrix
Take candidate features but only observations:
Then is :
Its determinant works out to exactly (checkable by cofactor expansion, or by noting a matrix built from only 2 independent rows of underlying data cannot have full rank 3) — confirming is singular, so doesn't exist and OLS has no unique solution. Now contrast with , using an additional two observations and added to : the resulting matrix generically has rank (full column rank), and the corresponding has a nonzero determinant, so it's invertible and OLS returns exactly one answer.
Worked example 2: ridge regression restores a unique answer
Ridge regression adds a small positive constant times the identity matrix before inverting:
In words: nudge every diagonal entry of up by before inverting — this guarantees invertibility regardless of rank, because adding to a matrix shifts every eigenvalue up by , and a matrix with all-positive eigenvalues is always invertible. Using the same , example, take : . This matrix now has a nonzero determinant (unlike the un-regularized version), so it can be inverted and is a single, well-defined vector even though . The cost is that is now biased toward zero relative to whatever the "true" coefficients might be — you've traded the complete non-identifiability of raw OLS for a unique but shrunk, and therefore biased, answer. The alternative path is reducing first — via feature selection, principal components, or an explicit sparsity assumption (most true coefficients are exactly zero) — so that ordinary methods apply to a smaller, well-posed problem.
When , OLS doesn't fail by becoming "more uncertain" — it fails by having infinitely many equally-perfect-fitting solutions, because is mathematically singular. Getting a unique, useful answer requires bringing in extra structure from outside the data: regularization, dimension reduction, or an explicit sparsity assumption.
What this means in practice
- This is the default regime for cross-sectional equity research with a large factor library. Hundreds of engineered signals or alternative-data features tested against a modest number of independent time periods routinely puts comfortably above (in the relevant, effectively-independent sense), so lasso-type sparsity assumptions or heavy dimension reduction aren't optional extras — they're required for the estimation problem to be well-posed at all.
- High-dimensional risk models face the same wall when the number of securities or candidate factors exceeds the number of independent history days — this is precisely why factor covariance estimation leans on structure (a small number of common factors) rather than a raw high-dimensional covariance matrix.
- Cross-validation still "runs" in software even when without regularization — a pseudo-inverse will silently return some numbers — which is exactly why this failure mode is dangerous rather than merely inconvenient; nothing crashes, but the output has no statistical meaning as an estimate of anything.
The classic confusion: treating as just a more severe version of ordinary small-sample noise, where the answer is still "the same estimate, but with wider confidence intervals." It's categorically different. Without added structure, the estimator isn't a noisy version of a unique truth — it's genuinely non-unique, with infinitely many equally-fitting solutions and no principled way, from the data alone, to prefer one over another. Statistical software that computes some answer via a pseudo-inverse can look exactly like a normal regression output, complete with coefficient values, while carrying zero statistical justification as an estimate of the true relationship — the numbers are real, but their meaning is not.
Related concepts
Practice in interviews
Further reading
- Hastie, Tibshirani & Wainwright, Statistical Learning with Sparsity, ch. 1-2
- Bühlmann & van de Geer, Statistics for High-Dimensional Data, ch. 2