Why Count the Fits?
Subset searches differ not only in the models they can reach, but also in how many candidate regressions they evaluate to get there. Counting those fits gives a useful first comparison of computational burden. In particular, exhaustive search considers every subset, while forward and backward procedures follow a sequence of greedy steps.
The counts below concern candidate regression fits, not the time required to fit each regression. A regression with more predictors can take more computation than one with fewer predictors, and software may reuse intermediate calculations. Even so, the number of candidate fits reveals an important difference in how the procedures scale.
Exhaustive Search: Count Every Subset
For each of the \(p\) predictors, an exhaustive search either includes it or excludes it. Each predictor therefore has two possibilities, and the choices are independent across predictors. The total number of subsets, including the empty subset, is
The empty subset corresponds to the intercept-only model under the counting convention above. If the question asks only for nonempty subsets, the count is \(2^p-1\). For a search restricted to models of exactly size \(k\), there are \({p \choose k}\) candidates. If it considers all sizes from zero through \(q\), the count is \(\sum_{k=0}^{q}{p \choose k}\).
These distinctions matter: a search over every subset is not the same as a search over every subset up to a specified size. State which collection is being counted before calculating.
Worked Example: Exhaustive Search With a Size Restriction
A hypothetical pricing analysis has \(p=8\) candidate predictors. An analyst wants to compare an exhaustive search over all models with the count for models of exactly size three and models of size at most three. How many regressions are in each collection?
Method. Use \(2^p\) for all subsets, \({p \choose k}\) for exactly size \(k\), and sum the binomial counts for sizes zero through three.
All subsets: \(2^8=256\), including the intercept-only model.
Exactly three predictors: \[ {8 \choose 3}=\frac{8\cdot7\cdot6}{3\cdot2\cdot1}=56. \]
At most three predictors: include sizes zero, one, two, and three: \[ {8 \choose 0}+{8 \choose 1}+{8 \choose 2}+{8 \choose 3} =1+8+28+56=93. \]
Check. The restricted collection of 93 models is smaller than the full collection of 256, and includes all 56 models of size exactly three. The common mistake this calculation avoids is using \(2^8\) when only models up to a specified size are requested.
Forward Selection: Add One Predictor at a Time
Forward selection begins with the intercept-only model and evaluates possible one-predictor additions. After selecting a predictor, it evaluates additions to the resulting model, continuing until it reaches the chosen target size \(q\). At a step where the current model has \(j\) predictors, there are \(p-j\) predictors remaining as possible additions.
Thus, the number of candidate regressions evaluated to reach size \(q\), not counting the initial intercept-only reference fit, is
The count falls from step to step because a predictor chosen at an earlier step is no longer a candidate addition. If forward selection runs all the way to size \(p\), the candidate-fit count is \(p+(p-1)+\cdots+1=p(p+1)/2\). Include one more fit if the starting intercept-only regression is also counted.
Worked Example: Forward Search to a Target Size
A hypothetical reserving team has \(p=10\) candidate predictors and plans to use forward selection until the model contains \(q=4\) predictors. How many candidate regressions are evaluated?
Method. Count the candidate additions separately at each step. At the first step all 10 predictors are available; each selected predictor reduces the next candidate set by one.
At step 1, evaluate \(10\) one-predictor additions. At step 2, evaluate \(9\) additions to the selected one-predictor model. At step 3, evaluate \(8\) additions, and at step 4, evaluate \(7\) additions. Therefore, \[ 10+9+8+7=34. \] The formula gives the same result: \[ \frac{q(2p-q+1)}{2} =\frac{4(20-4+1)}{2} =\frac{4\cdot17}{2} =34. \]
Check. The four evaluated stages produce candidate models of sizes one through four. The intercept-only starting fit is not included, so a count that includes that reference fit is \(34+1=35\). The common mistake this example avoids is multiplying \(q\) by \(p\), which would give \(4\cdot10=40\) and incorrectly assume ten available additions at every step.
Backward Elimination: Remove One Predictor at a Time
Backward elimination starts from the full model containing all \(p\) predictors. If the target is a model of size \(q\), the procedure evaluates possible removals from sizes \(p,p-1,\ldots,q+1\). From a model of size \(k\), there are \(k\) possible single-predictor removals. Therefore, the number of candidate regressions, excluding the initial full-model fit, is
The last candidate set is evaluated when the current model has \(q+1\) predictors: removing one produces a candidate model of size \(q\). If the initial full model is included in the count, add one. Continuing all the way to size zero requires \(p(p+1)/2\) candidate fits, plus the initial full-model fit if it is counted.
The forward and backward counts need not be equal when both procedures stop at the same size. Forward selection tests additions from the smaller models; backward elimination tests removals from the larger models. Their candidate sets are generated at different stages.
Worked Example: Backward Elimination to Five Predictors
A hypothetical insurer begins with \(p=12\) candidate predictors in a full regression and uses backward elimination until five remain. Find the number of candidate regressions evaluated, both excluding and including the starting full-model fit.
Method. At each current model size, count one candidate for each predictor that could be removed. To reach size five, removals are evaluated from sizes 12 down through 6.
The candidate counts are \[ 12+11+10+9+8+7+6=63. \] Using the formula gives \[ \frac{12(13)-5(6)}{2} =\frac{156-30}{2} =\frac{126}{2} =63. \] The initial full regression adds one if it is included, giving \(63+1=64\) fits in that convention.
Check. The final removal step compares six candidate models of size five, and the sum includes that step. The common mistake this example avoids is stopping the sum at seven: that would omit the six possible removals from the model of size six.
Comparing Fit Counts and Their Growth
For a complete forward path or a complete backward path, the number of candidate fits is \(p(p+1)/2\), which grows quadratically in \(p\). Exhaustive search instead evaluates \(2^p\) subsets, which grows exponentially. For small \(p\), the difference may be modest; for larger \(p\), exhaustive search can require vastly more regressions.
Worked Example: Comparing Search Costs at Twenty Predictors
A hypothetical risk-modeling study has \(p=20\) candidate predictors. Compare an exhaustive search over all subsets with complete forward and backward paths, using candidate-fit counts that exclude the greedy procedures’ starting reference fits.
Exhaustive search: there are \[ 2^{20}=1,048,576 \] subsets, including the intercept-only model.
Complete forward path: the successive candidate counts are \(20,19,\ldots,1\), so \[ \frac{20(21)}{2}=\frac{420}{2}=210. \]
Complete backward path: the successive removal counts are also \(20,19,\ldots,1\), giving \(210\) candidate fits. Counting each greedy procedure’s starting regression adds one, making each total 211.
Comparison and check. The exhaustive candidate-fit count is \(1,048,576/210\), or about \(4,993.2\) times the complete-path greedy count. This comparison concerns counts, not elapsed time: individual regressions can have different costs. The common mistake this example avoids is concluding that a greedy path evaluates only the \(p\) models it ultimately selects. It evaluates multiple alternatives at each step, for a total of 210 candidate fits here.
What the Counts Do and Do Not Say
These formulas count candidate subsets evaluated under a particular search procedure. They do not say that every subset of a given size is evaluated by a greedy search. For example, a forward procedure reaching size four evaluates four successive candidate layers along its selected path; it does not evaluate every four-predictor subset. Exhaustive search does evaluate all such subsets if it includes all model sizes.
Fit counts are also not identical to total computing time. A fit with \(k\) predictors may take more work than a fit with one predictor, and implementation choices can reduce repeated calculation. For a rough comparison, however, the exponential versus quadratic growth in the number of candidates is a central distinction. The counts also do not establish which procedure is preferable for a particular analysis; they describe search burden, not model quality.
Common Counting Traps
- Multiplying by the initial number of predictors at every forward step. The available set shrinks after each selected addition. Use \(p+(p-1)+\cdots\), not \(q p\).
- Omitting the last step. To reach size \(q\), forward selection evaluates additions that produce size \(q\); backward elimination evaluates removals that produce size \(q\).
- Mixing candidate fits with starting fits. The formulas exclude the intercept-only starting regression for forward selection and the full-model starting regression for backward elimination. Add one when the question asks for every fit including the start.
- Confusing all subsets with subsets of a specified size. Use \(2^p\) for all subsets, \({p\choose k}\) for exactly size \(k\), and a sum of binomial coefficients for a range of sizes.
- Equating a selected path with all models at that size. A greedy procedure evaluates candidates at each step, not every possible model of the final size.
Check Your Understanding
For each problem, use the same convention as above: count candidate fits separately from any starting reference fit.
- A hypothetical model has seven available predictors. How many candidate regressions does forward selection evaluate before reaching size three? (Answer: \(7+6+5=18\).)
- For nine predictors, how many subsets have exactly four predictors, and how many have at most two? Include the empty subset in the second count. (Answer: \({9\choose4}=126\); \(1+9+36=46\).)
- A backward search starts with 12 predictors and stops at size five. How many candidate removals are evaluated, and how many fits are counted if the initial full model is included? (Answer: \(12+11+10+9+8+7+6=63\) candidate fits; \(64\) including the start.)
- A forward search has 15 candidate predictors and stops at size six. Find its candidate-fit count, then compare it with exhaustive search over all subsets. (Answer: \(15+14+13+12+11+10=75\) versus \(2^{15}=32,768\) exhaustive fits.)
- With 11 candidate predictors, compare forward selection to size five with backward elimination to size five. Which evaluates fewer candidate regressions, and by how many? (Answer: forward \(=11+10+9+8+7=45\); backward \(=11+10+9+8+7+6=51\); forward evaluates 6 fewer.)