Tutorials › Statistical Genetics › Independent Holdout Validation

Prediction Models and Validation · Tutorial 717 of 989

Independent Holdout Validation

A careful holdout design separates model development from a one-time estimate of prediction performance in the intended population.

Advanced 10 min read

What You'll Learn

  • Define training and test sets for an already specified genetic prediction model
  • Distinguish model specification from estimating its parameters on training data
  • Preserve held-out outcomes from model fitting and development choices
  • Calculate and interpret simple performance measures on test individuals
  • Explain what population a holdout estimate represents and when it may mislead

Why Reserve Individuals for Testing?

A prediction model can appear to perform well on the same individuals used to estimate its parameters. That performance is not a fair estimate of how well the fitted model will predict new individuals: the model has already been adapted to the development data. A holdout design addresses this by separating individuals used for development from individuals reserved for evaluation.

In genetic prediction, the predictor may include a polygenic score, such as \(S_i=\sum_{j=1}^{m}\beta_jG_{ij}\), where \(G_{ij}\) is individual \(i\)'s genotype dosage at variant \(j\), and \(\beta_j\) is its specified weight. The prediction model might use this score alone or combine it with other predictors. This tutorial concerns how to evaluate an already specified model using a train–test split, not how to choose or construct the score.

Definition: A training set is the set of individuals used to fit model parameters or otherwise carry out model development. A test set (or holdout set) is a set of individuals kept out of those development decisions and used to estimate performance after the model is fixed. A holdout performance estimate is a performance measure calculated by comparing predictions with observed outcomes in that test set.

The test set must be held out from decisions, not merely from the final parameter-fitting step. If its outcomes help choose predictors, tune a model, set a classification threshold, or choose among candidate models, the resulting test performance is no longer a clean evaluation of those decisions. A model that has already been specified can still require parameter estimation; those parameters are estimated using training individuals, then the resulting fitted model is evaluated on the test individuals.

Specify the Split and the Evaluation Target

Before making the split, state the prediction target and the population in which performance is meant to apply. The earlier material on prediction targets and validation populations distinguishes these questions: a test set estimates performance for the population it represents, not automatically for every population in which a score might later be used. A random split of one cohort generally evaluates prediction in a population like that cohort, subject to how the cohort was sampled.

The model and evaluation plan should also be clear in advance. Specify the predictors, the form of the model, the outcome, and the performance measure. For a quantitative outcome, one possible measure is root mean squared prediction error. For a binary outcome, one simple measure is classification accuracy at a stated probability threshold. These measures answer different questions; no single measure summarizes every aspect of prediction.

Choose the split at the level of the independent observational units. In a simple setting where individuals are independent and sampled from the target population, randomly assigning individuals to training and test sets can give both sets a similar population composition. If observations have important dependencies, the split must respect those dependencies; a naive individual-level split may not provide an independent evaluation. The appropriate design also depends on whether the intended use is prediction in a similar population or prediction in a distinct setting.

1
Define the target.
State the outcome, intended prediction population, and performance measure before examining test outcomes.
2
Assign individuals.
Separate individuals into training and test sets using a plan appropriate to the sampling design and intended use.
3
Develop the model on training data.
Estimate any required parameters using training individuals. Keep test outcomes out of fitting and development decisions.
4
Freeze and evaluate.
Apply the fixed model to test individuals, calculate the prespecified performance measure once, and report the population and units to which it refers.

Worked Example: Allocating a Hypothetical Cohort

Suppose a hypothetical cohort contains 1,200 unrelated individuals sampled from the population in which a quantitative-trait prediction model is intended to be used. The research plan allocates 75% to training and 25% to testing. How many individuals are assigned to each set?

The planned test-set size is \(0.25(1{,}200)=300\). The training-set size is \(0.75(1{,}200)=900\), which also equals \(1{,}200-300\). Thus 900 individuals are assigned to training and 300 to testing.

Under the stated hypothetical assumptions, a random assignment of individuals can be used to make the sets representative of the same source population on average. The test set is not used to choose the model form or revise the plan after seeing its outcomes. The split itself does not guarantee that either set perfectly represents the population; it provides a design for evaluating the fitted model on individuals not used in its development.

Fit on Training Data, Predict on Test Data

Let \(Y_i\) denote the observed outcome for individual \(i\), and let \(\hat{Y}_i\) denote the model's prediction. For example, a linear prediction model might be specified as \(\hat{Y}_i=\hat{\alpha}+\hat{\beta}S_i+\hat{\boldsymbol{\gamma}}^\mathsf{T}\mathbf{C}_i\), where \(S_i\) is a genetic score and \(\mathbf{C}_i\) is a vector of other predictors. If the intercept and coefficients are to be estimated from the cohort, estimate them using training individuals only. Then apply those fitted coefficients to the test individuals.

Any data-dependent transformation needed to apply the model must also be determined using training data and then applied consistently to the test set. For example, if a predictor is centered using its training-set mean, use that same mean when transforming test individuals. If the model's coefficients and transformations were fixed in advance from an external source, apply those fixed quantities as specified rather than re-estimating them with test outcomes.

For quantitative outcomes, define the prediction error for individual \(i\) as \(e_i=Y_i-\hat{Y}_i\). A common summary is the test-set mean squared error, with root mean squared error reported in the outcome's units:

$$ \operatorname{MSE}_{\text{test}}=\frac{1}{n_{\text{test}}}\sum_{i\in\text{test}}(Y_i-\hat{Y}_i)^2, \qquad \operatorname{RMSE}_{\text{test}}=\sqrt{\operatorname{MSE}_{\text{test}}}. $$

MSE is in squared outcome units; RMSE is in the original outcome units. Smaller values indicate smaller typical squared errors for the test individuals, but interpretation depends on the trait scale and the target population. A test score is a sample-based estimate, not a guarantee of performance for every future individual.

Worked Example: Quantitative-Trait Prediction Error

In a hypothetical test set, the observed trait values for four individuals are 10, 12, 15, and 18 units. A model fitted using training individuals predicts 11, 11, 13, and 20 units, respectively. Calculate the test MSE and RMSE.

The prediction errors \(Y_i-\hat{Y}_i\) are \(10-11=-1\), \(12-11=1\), \(15-13=2\), and \(18-20=-2\) units. Their squared errors are \(1\), \(1\), \(4\), and \(4\) squared units. Therefore,

$$ \operatorname{MSE}_{\text{test}} =\frac{1+1+4+4}{4} =\frac{10}{4} =2.50\ \text{units}^2, \qquad \operatorname{RMSE}_{\text{test}}=\sqrt{2.50}=1.581\ \text{units}. $$

For these four hypothetical test individuals, the RMSE is 1.581 trait units. It summarizes the magnitude of prediction errors on the trait's original scale, with larger errors contributing more because the errors are squared. The calculation is a worked illustration, not a precise estimate for a broad population: four individuals provide little information about typical performance.

Binary Outcomes and a Prespecified Decision Rule

For a binary outcome, a model may produce a predicted probability \(\hat{p}_i\). If classification accuracy is the chosen measure, a decision rule is needed to turn probabilities into predicted classes. For example, classify an individual as positive when \(\hat{p}_i\geq 0.50\), and negative otherwise. That threshold must be fixed without using test outcomes. Accuracy is the fraction of test individuals whose predicted classes match their observed classes; it depends on the threshold and the distribution of outcomes in the test population.

Worked Example: Accuracy With a Fixed Threshold

A hypothetical model gives probabilities for ten held-out individuals. The probabilities are 0.80, 0.70, 0.60, 0.55, 0.45, 0.40, 0.30, 0.20, 0.65, and 0.35. Their observed outcomes, in the same order, are 1, 1, 0, 1, 0, 0, 1, 0, 1, and 0. Use the prespecified threshold 0.50 to calculate accuracy.

The first, second, third, fourth, and ninth probabilities are at least 0.50, so the model predicts class 1 for those individuals. It predicts class 0 for the other five. Comparing these classifications with the observed outcomes gives correct classifications for individuals 1, 2, 4, 5, 6, 8, 9, and 10: eight correct out of ten.

$$ \operatorname{Accuracy}_{\text{test}}=\frac{8}{10}=0.800=80.0\%. $$

In this hypothetical test set, 80.0% of classifications made using the 0.50 threshold were correct. This does not mean the model has 80% accuracy at every threshold or in every population. Changing the threshold after inspecting these test outcomes would make this no longer a clean one-time evaluation of the chosen decision rule.

Why the Holdout Estimate Works—and Its Limits

The basic justification is that the test individuals are not used to fit the fixed model, so their outcomes can provide new information about its prediction errors. More formally, let \(D_{\text{train}}\) be the training data and let \(f\) be the fitted model resulting from them. Define the loss for a new individual as \(L(Y,f(X))\), where \(X\) denotes that individual's predictors. The target risk for this fitted model is the expected loss in the intended population, conditional on the training data.

$$ R(f\mid D_{\text{train}}) =E\!\left[L(Y,f(X))\mid D_{\text{train}}\right]. $$

If the test individuals are independent draws from that target population and the model \(f\) is fixed without using their outcomes, each test loss has this same conditional expectation. Provided the loss has a finite expectation, linearity of expectation gives:

$$ E\!\left[ \frac{1}{n_{\text{test}}} \sum_{i\in\text{test}}L(Y_i,f(X_i)) \,\middle|\,D_{\text{train}} \right] = \frac{1}{n_{\text{test}}} \sum_{i\in\text{test}} E\!\left[L(Y_i,f(X_i))\mid D_{\text{train}}\right] = R(f\mid D_{\text{train}}). $$

Thus, under these assumptions, the average test loss is unbiased for the expected loss of this fitted model in the target population, conditional on the training data. This argument does not say that a particular test-set estimate will equal the population risk; sampling variation remains. Nor does it show that the model will perform equally well in a population with a different outcome distribution or predictor distribution.

Using the test set repeatedly to choose among models changes the situation. For example, suppose several candidate models have test loss estimates \(T_1,\ldots,T_K\), and the model with the smallest estimate is selected. The selected estimate is \(\min_k T_k\). Since \(\min_k T_k\leq T_j\) for every candidate \(j\), it follows that \(E[\min_k T_k]\leq E[T_j]\) for every \(j\), and hence \(E[\min_k T_k]\leq\min_k E[T_k]\). The smallest observed test loss can therefore be optimistically low relative to the best candidate's true expected loss. The test outcomes have become part of model selection, rather than an independent evaluation of a fixed choice.

Common Mistakes and Practical Interpretation

  • Calling training performance validation. Performance calculated on the individuals used to fit parameters is not a held-out estimate. Report clearly which individuals contributed to each calculation.
  • Making choices after checking test outcomes. Changing predictors, model settings, or a classification threshold in response to test results uses the test set for development. The final reported test performance then reflects that reuse.
  • Assuming a random split answers every population question. A random split generally evaluates performance for a population like the one sampled. It does not establish transportability to a different ancestry, clinical setting, or sampling scheme.
  • Reporting a metric without its definition or units. State how predictions were evaluated. For example, RMSE for a quantitative trait is reported in trait units; classification accuracy should be accompanied by the rule used to assign classes.
  • Treating one estimate as certainty. A finite test set gives an estimate with sampling variability. A single number does not imply identical performance for every individual or future sample.
Key takeaway: Specify the target and evaluation plan, separate individuals before model development, fit or finalize the model without test outcomes, and calculate the chosen performance measure on the untouched test set. The resulting estimate describes the fixed model's performance for a population represented by that test set, subject to sampling uncertainty.

Check Your Understanding

Answer each question before reviewing the worked examples.

  1. A researcher fits a genetic prediction model on 700 individuals and calculates its performance on those same individuals. Is that a holdout estimate? Explain.
  2. A model has a predicted probability for a binary outcome. What must be decided before calculating test-set accuracy at a threshold?
  3. For what target population does a randomly split test set provide the most direct evidence about prediction performance?
  4. Why should a test set not be used to choose which of several candidate models to report?
  5. A quantitative-trait model has test RMSE of 2.4 kg. State the unit and the basic interpretation of this result.
Clinical Biostats