Tutorials › Exam SRM - Statistics for Risk Modeling › Prediction Versus Variable Selection

Exam SRM · Elastic Net and Validation · Tutorial 245 of 926

Prediction Versus Variable Selection

Compare elastic-net choices by predictive error or by the need for a sparse, interpretable set of predictors.

Advanced 10 min read

What You'll Learn

  • Define predictive accuracy and sparsity as distinct model-selection goals
  • Interpret the roles of alpha and lambda in the elastic-net objective
  • Compare candidate models using validation mean squared error
  • Choose a sparse model subject to an explicit error tolerance or complexity cost
  • Recognize why the best predictive model need not be the best compact model
  • Avoid treating selected predictors as proof of causal importance

Why the Tuning Goal Matters

Elastic net can produce models that differ in two important ways: how well they predict new responses and how many predictors they retain. Those goals can point to different choices of the mixing parameter \(\alpha\) and penalty parameter \(\lambda\). The best choice depends on what the model is meant to do, not simply on which fitted model looks simplest.

For example, a hypothetical insurer might use a model to predict claim costs as accurately as possible, even if several related rating variables contribute to the predictions. A different task might require a short list of predictors that analysts can review, explain, and maintain. A compact model may be preferable for that task even if its predictions are somewhat less accurate.

Definition: For a fitted model, predictive performance describes how well its predictions perform on new observations, measured using a specified loss function. Sparsity describes how few predictors have nonzero fitted coefficients. Prediction and sparsity are different criteria: improving one does not guarantee improving the other.

Elastic-Net Choices and the Two Goals

For \(n\) observations and \(p\) predictors, consider the elastic-net estimate that minimizes the following objective, with the intercept left unpenalized:

$$ \frac{1}{2n}\sum_{i=1}^n \left(y_i-\beta_0-\sum_{j=1}^p x_{ij}\beta_j\right)^2 +\lambda\left[ \alpha\sum_{j=1}^p|\beta_j| +\frac{1-\alpha}{2}\sum_{j=1}^p\beta_j^2 \right]. $$

Here \(\lambda\geq 0\) sets the overall penalty strength, and \(0\leq\alpha\leq1\) sets the balance between the absolute-value penalty and the squared-coefficient penalty. At \(\alpha=1\), the objective is lasso; at \(\alpha=0\), it is ridge. Intermediate values combine both. The absolute-value component can set coefficients exactly to zero, while the squared-coefficient component generally shrinks coefficients without setting them exactly to zero. In practice, predictor scaling matters, and comparisons should use predictors prepared consistently.

A model’s support is the set of predictors whose fitted coefficients are nonzero. A support of size \(k\) means that \(k\) predictors are retained. Support size is a useful summary of complexity, but it does not tell us whether the predictions are accurate or whether the selected predictors have a causal interpretation.

Key distinction: A prediction-focused choice minimizes an estimate of future prediction loss. A selection-focused choice favors a small support, often subject to an acceptable loss limit or an explicit cost for retaining predictors. Neither goal automatically determines a universal best pair \((\alpha,\lambda)\).

A validation set can be used to compare the predictions from candidate models. If squared error is the chosen loss, the validation mean squared error (MSE) is

$$ \operatorname{MSE}_{\mathrm{val}} =\frac{1}{m}\sum_{i=1}^{m}(y_i-\hat y_i)^2, $$

where \(m\) is the number of validation observations, \(y_i\) is an observed response, and \(\hat y_i\) is the candidate model’s prediction. This tutorial uses a separate held-out validation set in its examples. A low validation MSE is evidence about predictive performance for observations from the same target population and measurement setting; it is not a guarantee of future performance.

Why Prediction Error and Sparsity Can Disagree

A brief decomposition explains why a model can be useful for prediction without being a compact description. Suppose a new response \(Y\), given predictors \(x\), has conditional mean \(\mu(x)=E[Y\mid x]\) and conditional variance \(\sigma^2(x)=\operatorname{Var}(Y\mid x)\). For a fixed prediction \(\hat f(x)\), write \(Y-\hat f(x)=[Y-\mu(x)]+[\mu(x)-\hat f(x)]\). Squaring and taking the conditional expectation gives

$$ E\left[(Y-\hat f(x))^2\mid x\right] =\sigma^2(x)+\left[\mu(x)-\hat f(x)\right]^2. $$

The cross-product has conditional expectation zero because \(E[Y-\mu(x)\mid x]=0\). Thus, conditional prediction error contains irreducible response variation and a squared discrepancy between the model’s prediction and the conditional mean. This expression concerns predictive loss; it contains no term for the number of nonzero coefficients. Sparsity is an additional modeling preference or constraint, not a consequence of minimizing squared prediction error.

Worked Example: Choose the More Accurate Predictor

A hypothetical claims team fits two elastic-net models to standardized predictors and evaluates both on the same six held-out policies. Model A uses \(\alpha=0.25,\lambda=0.20\) and has four nonzero coefficients, \((0.42,-0.31,0.18,0.09,0)\). Model B uses \(\alpha=0.85,\lambda=0.65\) and has two nonzero coefficients, \((0.55,-0.20,0,0,0)\). The validation residuals, defined as observed minus predicted response, are \((0.5,-0.5,1,-1,1.5,-1.5)\) for A and \((1,-1,1,-1,2,-2)\) for B. Which model predicts better under squared error, and which is sparser?

Method. Compute each validation SSE (sum of squared errors), divide by the common validation sample size of six, and separately count nonzero coefficients.

For A, the squared residuals are \(0.25,0.25,1,1,2.25,2.25\). Therefore,

$$ \operatorname{SSE}_A=0.25+0.25+1+1+2.25+2.25=7, \qquad \operatorname{MSE}_A=\frac{7}{6}=1.1667. $$

For B, the squared residuals are \(1,1,1,1,4,4\). Therefore,

$$ \operatorname{SSE}_B=1+1+1+1+4+4=12, \qquad \operatorname{MSE}_B=\frac{12}{6}=2.0000. $$

Model A has lower validation MSE, so it is preferred for prediction under the stated loss. Model B is sparser: it has two nonzero coefficients instead of four. Check: both MSE calculations use the same six observations, and both support counts match the listed coefficient vectors. The common mistake this comparison avoids is calling the sparser model the more accurate one without comparing its prediction errors.

Selection with an Explicit Simplicity Requirement

If a compact predictor set is important, state that preference as a rule rather than treating “simple” as a vague substitute for “good.” One option is to require validation MSE to be at most a prespecified tolerance and then choose the smallest support among models that meet it. Another is to assign an explicit cost to each retained predictor and compare a combined score. These rules can select a different model from the one with the smallest MSE.

Worked Example: Meet an Error Limit with the Fewest Predictors

A hypothetical analyst compares three models for predicting repair payments. All use the same five validation cases and squared-error loss. Model A has \((\alpha,\lambda)=(0.25,0.15)\), support size 5, and residuals \((1,-1,1,-1,0)\). Model B has \((\alpha,\lambda)=(0.75,0.55)\), support size 2, and residuals \((1,-1,1,-1,1)\). Model C has \((\alpha,\lambda)=(0.95,1.00)\), support size 1, and residuals \((1,-1,2,-1,2)\). The business requirement is validation MSE no greater than 1.10; among models meeting that requirement, choose the smallest support. Which model is selected?

Method. Compute all three MSE values, apply the stated tolerance, and compare support sizes only among the eligible candidates.

For A, the squared residuals are \(1,1,1,1,0\), so \(\operatorname{SSE}_A=4\) and \(\operatorname{MSE}_A=4/5=0.8000\). For B, the squared residuals are \(1,1,1,1,1\), so \(\operatorname{SSE}_B=5\) and \(\operatorname{MSE}_B=5/5=1.0000\). For C, the squared residuals are \(1,1,4,1,4\), so \(\operatorname{SSE}_C=11\) and \(\operatorname{MSE}_C=11/5=2.2000\).

A and B meet the \(1.10\) limit; C does not. Between the eligible models, B has the smaller support, with two predictors rather than five. The selection rule therefore chooses B, even though A has lower validation MSE. Check: the chosen model satisfies \(1.0000\leq1.10\), and no eligible model has a support smaller than two. The mistake to avoid is choosing C just because it has the fewest predictors: it violates the required accuracy limit.

Making the Trade-Off Explicit

A third approach assigns a cost to complexity. For example, an analyst might compare

$$ J=\operatorname{MSE}_{\mathrm{val}}+c\,k, $$

where \(k\) is support size and \(c\geq0\) is a stated cost per retained predictor, expressed on a scale compatible with the MSE. This score is a decision rule, not a universal statistical law. Its value depends on the actual cost of maintaining or explaining additional predictors.

Worked Example: Prediction Versus a Predictor-Maintenance Cost

A hypothetical benefits administrator compares three candidate models on six held-out observations. Model A has \((\alpha,\lambda)=(0.10,0.10)\), five nonzero coefficients, and validation residuals \((0.5,-0.5,0.5,-0.5,1,-1)\). Model B has \((\alpha,\lambda)=(0.70,0.40)\), two nonzero coefficients, and residuals \((1,-1,1,-1,1,-1)\). Model C has \((\alpha,\lambda)=(1.00,0.90)\), one nonzero coefficient, and residuals \((1,-1,2,-2,2,-2)\). The administrator first asks for the best predictor under MSE, then applies \(J=\operatorname{MSE}_{\mathrm{val}}+0.50k\) to reflect a hypothetical maintenance cost. Which model wins each comparison?

Method. Calculate MSE from each residual vector. Then add \(0.50\) times the model’s support size to obtain its decision score \(J\).

For A, the squared residuals sum to \(0.25+0.25+0.25+0.25+1+1=3\), so its MSE is \(3/6=0.5000\). Its combined score is \(J_A=0.5000+(0.50)(5)=3.0000\).

For B, the six squared residuals are all 1, so its MSE is \(6/6=1.0000\). Its score is \(J_B=1.0000+(0.50)(2)=2.0000\).

For C, the squared residuals sum to \(1+1+4+4+4+4=18\), so its MSE is \(18/6=3.0000\). Its score is \(J_C=3.0000+(0.50)(1)=3.5000\).

A is the best predictor under MSE alone, because \(0.5000\) is the smallest MSE. B has the smallest combined score, since \(2.0000<3.0000<3.5000\). Check: the complexity terms are \(2.50\), \(1.00\), and \(0.50\), respectively; adding these to the MSEs gives the reported scores. The result depends on the stated cost of \(0.50\), not on an inherent rule that a two-predictor model is always preferable.

Interpreting Alpha and Lambda Carefully

The examples show that \(\alpha\) and \(\lambda\) help generate candidate models, but neither parameter directly states the analyst’s goal. Increasing \(\alpha\) places relatively more emphasis on the lasso component, which can encourage exact zeros. Increasing \(\lambda\) strengthens the overall penalty and generally increases shrinkage. The exact fitted support and validation error also depend on the data, predictor correlations, and the joint values of the parameters. A large \(\alpha\) does not by itself guarantee a particular support size, and a smaller support does not guarantee better predictions.

When prediction is the priority, compare candidate predictions using a loss function appropriate to the task. When variable selection is the priority, define what “small enough” means: a predictor budget, a validation-loss tolerance, or a complexity cost. If both aims matter, state the trade-off explicitly. A model selected for compactness should not be described as the most accurate unless the comparison supports that claim.

Common Exam Traps

  • Equating sparsity with predictive quality. A model with fewer nonzero coefficients can have larger validation loss. Compare loss values when prediction is the stated goal.
  • Using the tuning parameter as the decision rule. “Choose the largest \(\alpha\)” is not the same as “choose the smallest acceptable model.” Check the resulting support and performance.
  • Changing the goal mid-comparison. Selecting one model by MSE and another by support is only justified if the task states a combined or constrained criterion.
  • Treating selected predictors as causal findings. Penalized regression selects coefficients under a specified model and penalty. A nonzero coefficient alone does not establish a causal effect or prove that the variable is substantively essential.
  • Ignoring the validation sample size. Compare mean losses on the same observations, or otherwise account for differing sample sizes; raw sums of squared errors are not directly comparable when sample sizes differ.
Key takeaway: Prediction asks how well a model forecasts new responses; variable selection asks how compact its nonzero-coefficient set is. Choose \((\alpha,\lambda)\) according to the stated objective, and report the performance and complexity evidence separately. These distinctions are aligned with the SOA Exam SRM (Statistics for Risk Modeling) syllabus.

Check Your Understanding

For each problem, identify the criterion being applied and check the arithmetic before deciding.

  1. Two models are assessed on four common validation observations. Model P has residuals \((1,-1,1,-1)\) and three nonzero coefficients. Model Q has residuals \((0.5,-0.5,1,-1)\) and two nonzero coefficients. Which has lower validation MSE, and what are both MSE values? (Answer: P has MSE \(1.0000\); Q has MSE \(0.6250\), so Q has lower validation MSE and is also sparser.)
  2. A three-predictor model has \(\operatorname{SSE}=12\) on six validation observations. A one-predictor model has \(\operatorname{SSE}=15\) on the same observations. If the rule is to minimize MSE without a complexity penalty, which model is preferred? (Answer: The three-predictor model; its MSE is \(12/6=2.0000\), compared with \(15/6=2.5000\).)
  3. Three candidates have validation MSE and support sizes \((0.8,4)\), \((1.0,2)\), and \((1.6,1)\). The rule requires MSE at most 1.1 and then minimizes support. Which is selected? (Answer: The second candidate, with MSE 1.0 and support size 2.)
  4. For a model with validation residuals \((2,-1,0)\) on three observations and support size 2, calculate its MSE. If the accuracy limit is 1.5, does it qualify? (Answer: SSE \(=4+1+0=5\), MSE \(=5/3=1.6667\); it does not qualify.)
  5. Two models have \((\operatorname{MSE},k)=(1.2,4)\) and \((1.7,1)\). Under \(J=\operatorname{MSE}+0.30k\), which has the lower score? (Answer: The first score is \(1.2+0.30(4)=2.4\); the second is \(1.7+0.30(1)=2.0\), so the one-predictor model has the lower score.)
Clinical Biostats