Best Subset Selection: Searching Every Model, and Why the Criterion Does the Real Work

With p candidate predictors there are 2p possible regression models, counting the intercept-only model and the full model. Best subset selection considers this entire subset space and chooses among its candidates by an explicitly stated criterion.


A direct exhaustive implementation can fit every subset; an exact branch-and-bound implementation may instead prune candidates when valid bounds prove they cannot change the optimum.


Everything interesting about the method lies in the exhaustive scope of the search, the choice of criterion, and what each costs.

The two-stage procedure

In practice the search is organised by model size:


  1. For each size k = 0, 1, …, p, identify the subset with the smallest residual sum of squares among the C(p, k) candidates. A direct exhaustive implementation fits each candidate; an exact search may safely prune candidates when valid bounds show they cannot beat the size-specific minimum. Within a fixed size, RSS is a legitimate comparison because the models have the same number of parameters.
  2. Compare the p + 1 survivors across sizes using a criterion that accounts for complexity - Mallows' Cp, AIC, BIC, adjusted R2, or a cross-validated prediction error.


Step 2 needs a different tool from step 1 for a structural reason.


Adding a predictor to a least-squares fit can never increase RSS, because the smaller model is a special case of the larger one with a coefficient constrained to zero, and removing a constraint cannot worsen an optimum.


So the minimum RSS is non-increasing in size and R2 is non-decreasing. The full model always attains the minimum RSS and maximum R2, possibly tied with smaller subsets when extra predictors add no fit improvement.


Raw RSS alone cannot select a preferred size: it gives no basis for choosing among tied minimizers.

Criteria that can compare across sizes

Write n for the sample size and k for the number of estimated parameters including the intercept, so a model with three predictors has k = 4. That convention has to be fixed before any number is computed; it is the most common source of arithmetic disagreement in this topic.


  • Mallows' Cp = RSSk/σ̂2 − n + 2k, where σ̂2 is the residual variance estimated from the full model. Small values are preferred, and a model with little bias has Cp near k.
  • Adjusted R2 = 1 − [RSS/(n − k)] / [TSS/(n − 1)]. Larger is preferred. It can decrease when a predictor is added, which raw R2 cannot.
  • AIC = n ln(RSS/n) + 2k and BIC = n ln(RSS/n) + k ln n, both smaller-is-better and both defined up to an additive constant, so only differences between models fitted to the same data are meaningful.


Because ln n > 2 for every n ≥ 8, BIC penalises each extra parameter more heavily than AIC does, and it therefore tends to favor smaller models than AIC.


BIC therefore cannot select a larger model than AIC from the same candidate set under these formulas; it may select the same model when the gain in fit is sufficiently large, or a smaller model otherwise.


The reason is that the two criteria share an identical fit term and differ only in a per-parameter charge, so raising that charge can only move the optimum toward fewer parameters, never toward more.


The two criteria are not competing estimates of one quantity: AIC targets predictive accuracy, BIC targets identification of the model that generated the data. They can and do disagree.

Worked example

Take n = 40 observations and p = 5 candidate predictors, so the exhaustive search covers 25 = 32 models. Suppose the total sum of squares is TSS = 500.0 and the smallest RSS at each size is:


Size

k

RSS

Cp

Adjusted R2

BIC

0

1

500.0

59.70

0.0000

104.72

1

2

280.0

18.71

0.4253

85.21

2

3

192.0

3.52

0.5952

73.81

3

4

176.0

2.39

0.6187

74.02

4

5

174.5

4.10

0.6111

77.37

5

6

174.0

6.00

0.6008

80.94


The full model gives σ̂2 = 174.0/(40 − 6) = 5.1176. Then, for instance, the three-predictor model has Cp = 176.0/5.1176 − 40 + 8 = 34.391 − 32 = 2.39, and its adjusted R2 = 1 − (176.0/36)/(500.0/39) = 1 − 4.8889/12.8205 = 0.6187. Its BIC is 40 ln(176.0/40) + 4 ln 40 = 59.264 + 14.756 = 74.02.


Three things in that table are worth extracting.


RSS is useless across sizes. It falls monotonically, 500.0 down to 174.0, and would pick the full model. Yet the last two predictors together cut RSS by only 2.0 out of 500, which no sensible analysis would call a finding.


The full model's Cp is 6.00, exactly its own k. That is an algebraic identity, not a coincidence: substituting RSSfull = (n − kfull)σ̂2 gives Cp = kfull.


It is a useful check on any Cp column, and it is also why σ̂2 must come from the full model - using each subset's own residual variance would force Cp = k for every model and destroy the comparison entirely.


The criteria disagree. Cp is minimised at size 3 (2.39) and adjusted R2 is maximised there (0.6187), but BIC is minimised at size 2 (73.81, against 74.02 for size 3).


That gap is small, and the honest report is that the data do not sharply distinguish a two- from a three-predictor model.


Criterion disagreement is information about the strength of the evidence, not a defect to be resolved by quoting whichever criterion gives the preferred answer.

What exhaustiveness costs

The count 2p grows fast: 1,024 models at p = 10, about a million at p = 20, and roughly 34 million at p = 25. Branch-and-bound implementations (the leaps-and-bounds algorithm) use valid bounds on achievable RSS to prune regions of the subset space while preserving the exact result, so they need not fit every candidate separately and can push exhaustive search to roughly 30-40 predictors.


The underlying problem remains exponential; large high-dimensional applications, including many p > n settings common in genomics and text data, are ordinarily computationally impractical, but p > n alone neither makes subset selection undefined nor guarantees infeasibility; feasibility depends chiefly on p, hardware, and the search method.


The computational cost of exhaustive search motivates alternatives such as stepwise selection. The lasso offers another reason to use a different approach: its coefficient shrinkage can improve prediction and perform variable selection even when exhaustive search is computationally feasible.

The statistical cost, which is the one that is usually overlooked

Exhaustiveness guarantees that the criterion is optimised - not that the right model is found. Searching 2p models means taking a maximum over a very large number of noisy quantities, and a maximum of noise is biased upward. Consequences that follow directly:


  • The selected model's R2 overstates, on average, how well it will predict new data.
  • Ordinary fixed-model inference is not valid after selection, because the statistics are computed as if the model had been specified in advance rather than chosen for fitting this sample well. It tends to be anti-conservative: on average, or in repeated sampling, t-statistics are inflated, p-values are too small, and confidence intervals cover the true value less often than their nominal level. Those are tendencies, not guarantees about any one statistic or interval computed from a single data set.
  • Which subset wins is itself unstable: a modest change in the sample, or in a few observations, can return a different set of predictors, especially when candidates are correlated.


The remedies are structural rather than cosmetic. Estimate predictive performance on data not used for selection, either by holding out a genuine test set or by cross-validation in which the entire selection procedure is rerun inside each fold - selecting first and cross-validating afterwards reuses the same data and reproduces the bias.


For inference on the selected coefficients, split the sample, or use a method designed for post-selection inference. Reporting a best-subset model's ordinary regression table as though the model had been pre-specified is the characteristic error of this technique.


Finally, the scope of the claim. A best subset procedure answers "which subset optimises this criterion on this sample," and it can do that perfectly while the true data-generating model is absent from the candidate set entirely.


Residual and influence diagnostics, transformations of the response, and checking of the regression assumptions are separate steps handled by neighbouring concepts, and none of them is performed by the search itself.

An analyst is applying best subset selection to p candidate predictors. After finding the lowest-RSS subset at each size, which description gives the standard second stage for choosing a model size?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

An analyst runs a best subset search over 6 candidate predictors and tabulates, for each subset size 0 through 6, the smallest residual sum of squares attained at that size. She observes that this minimum RSS decreases at every step, from the intercept-only model through to the full six-predictor model. What should she conclude from this pattern?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A best subset search is run on n = 60 observations with 7 candidate predictors. The full seven-predictor model has residual sum of squares 208.0. The best four-predictor subset has residual sum of squares 226.0. Using

Cp = RSSk/σ̂2 − n + 2k

where σ̂2 is the residual mean square from the full model and k is the number of estimated parameters including the intercept, calculate Cp for the four-predictor subset. Give your answer as a decimal number, to two decimal places.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors