Quant Memo
Advanced

Stepwise and Best Subset Selection

Two classic methods for choosing which predictors belong in a regression model — one that greedily adds or drops variables one at a time, and one that in principle checks every possible combination.

With pp candidate predictors, best subset selection fits a separate regression for every possible subset of them — 2p2^p models in total — and picks the best by a criterion like adjusted R-squared or AIC that penalizes extra variables. This is exhaustive and guaranteed to find the best-scoring subset of any given size, but becomes computationally impossible once pp climbs past the low twenties, since 2202^{20} is already over a million models.

Stepwise selection is the practical workaround: instead of checking every subset, it builds the model greedily. Forward stepwise starts with no predictors and adds, at each step, whichever single remaining variable improves the fit the most, stopping once no addition helps enough. Backward stepwise starts with all predictors and removes the least useful one at each step. Both require only on the order of p2p^2 model fits rather than 2p2^p, making them feasible for hundreds of candidate factors, at the cost of no longer being guaranteed to find the globally best subset — a greedy step taken early can lock out a combination that would have scored better overall.

In quant factor research, a researcher with 80 candidate signals might use forward stepwise to narrow down to a handful that jointly explain returns, understanding that the resulting model is a good, not provably optimal, subset, and cross-checking the survivors out of sample since stepwise procedures are especially prone to overfitting when many candidates are tried against the same data.

Best subset selection checks every possible combination of predictors and is exhaustive but computationally infeasible beyond a couple dozen candidates; stepwise selection builds the model greedily one variable at a time, scaling to hundreds of candidates but without a guarantee of finding the truly best subset.

Related concepts

Practice in interviews

Further reading

  • James, Witten, Hastie, Tibshirani, An Introduction to Statistical Learning, ch. 6
ShareTwitterLinkedIn