Tutorials › Quantitative Systems Pharmacology (QSP) › Diagnosing Overfit In Small Virtual Populations

Virtual Patient Generation · Tutorial 703 of 799

Diagnosing Overfit In Small Virtual Populations

Learn a practical diagnostic workflow for distinguishing a robust small virtual population from one that matches its targets only through overfitting.

Advanced 11 min read

What You'll Learn

  • Define target residuals using prespecified scales or tolerances.
  • Summarize the overall size and pattern of target mismatches without treating a fit score as a p-value.
  • Compare parameter spread before and after virtual-patient selection.
  • Use leave-one-patient-out calculations to find targets driven by a single virtual patient.
  • Combine diagnostics and choose follow-up checks without relying on a single cutoff.

Why a Small Virtual Population Can Match Too Well

A virtual population is a collection of mechanistic parameter vectors representing variation across patients. When the population is small and must match many targets, selection or tuning can produce an apparently excellent fit that depends on a narrow set of parameter values or one unusual virtual patient. Such a fit may reproduce the chosen summaries while representing the intended patient variability poorly.

Here, overfit means that the construction has been tuned to match the specified targets so closely that the match is fragile or achieved at the expense of plausible patient-to-patient variation. A small number of targets alone does not prove overfitting, and a large target count alone does not prove it either: targets can be redundant, and their difficulty depends on the candidate population and construction procedure. The diagnosis therefore combines target residuals, parameter diversity, and sensitivity to individual virtual patients.

The earlier material on optimization-based virtual population selection and matching population summaries supplies the context: each virtual patient has a parameter vector, and each target is a summary computed from the selected population. The diagnostics below assess whether the resulting match is dependable; they do not establish that the targets themselves are correct or that the model is clinically predictive.

Target Residuals on Comparable Scales

Definition: For target \(j\), let \(t_j\) be the target value and let \(g_j(V)\) be the corresponding summary calculated from virtual population \(V\). The raw target residual is \(e_j=g_j(V)-t_j\). If a positive scale \(s_j\) is specified for that target, the scaled residual is \(r_j=e_j/s_j\). A scale may be a prespecified tolerance or another scientifically justified measure of acceptable discrepancy.

A raw residual has the units of its target: a clearance residual might be in L/h, whereas a response residual might be in percentage points. Scaled residuals make discrepancies easier to compare across targets, but only when their scales are chosen and justified. A scale of zero is invalid, and choosing scales after seeing the fit can make an inadequate match look acceptable.

One descriptive summary is the mean squared scaled residual:

$$ Q=\frac{1}{m}\sum_{j=1}^{m}r_j^2 $$

Here \(m\) is the number of targets included. \(Q\) is a fit summary, not a p-value, a probability, or a universal pass/fail test. It can conceal a single large discrepancy, so inspect the individual \(r_j\) values as well. If the construction uses target ranges, assess each summary against its stated range rather than treating the range midpoint as an exact target without justification.

Worked Example: Checking Several Scaled Target Residuals

Suppose a hypothetical six-patient virtual population is assessed against three targets. Mean clearance has target \(10.0\) L/h and tolerance \(1.0\) L/h; mean EC50 has target \(5.0\) nM and tolerance \(0.5\) nM; and mean response has target \(60\%\) and tolerance \(5\) percentage points. The generated summaries are \(10.4\) L/h, \(4.7\) nM, and \(64\%\), respectively.

Using each tolerance as \(s_j\), the residuals are:

$$ r_{\mathrm{clearance}}=\frac{10.4-10.0}{1.0}=0.40,\qquad r_{\mathrm{EC50}}=\frac{4.7-5.0}{0.5}=-0.60,\qquad r_{\mathrm{response}}=\frac{64-60}{5}=0.80. $$

Each absolute scaled residual is below 1, so each summary lies within one stated tolerance of its target. The combined score is

$$ Q=\frac{0.40^2+(-0.60)^2+0.80^2}{3} =\frac{0.16+0.36+0.64}{3} =0.387, \qquad \sqrt{Q}=0.622. $$

This describes the three target discrepancies, not the population's diversity or stability. In particular, the good-looking residuals do not show whether all six patients have similar parameter values or whether one patient is essential to the match.

Check Whether Parameter Variation Has Collapsed

A virtual population is intended to represent a range of plausible patients, not merely to reproduce a few aggregate summaries. Compare the spread of important parameters in the selected population with the spread in the eligible candidate population or another scientifically justified reference. Use the same parameter definitions and units in both groups. For parameters with different units or scales, use dimensionless summaries such as a coefficient of variation only when the parameter is positive and a ratio-based spread is meaningful; otherwise, standardize by a defensible reference scale.

For a parameter \(x\) measured across \(n\) virtual patients, the sample standard deviation \(s\) summarizes variation around the sample mean \(\bar{x}\). It should be read alongside the parameter's units and distribution: a standard deviation alone does not describe skewness or unusual values. For multiple parameters, inspect each scientifically important parameter and the joint pattern. A population can retain variation in every marginal parameter yet have an implausibly restricted combination of parameters.

This is a diagnostic comparison, not a rule that selected spread must equal candidate spread. Selection is supposed to change the population when targets or feasibility constraints warrant it. Concern arises when fit improves dramatically while spread contracts sharply without a scientific reason, especially when many parameters were adjusted to meet a small set of summaries.

Worked Example: Target Means Fit but Parameter Spread Contracts

Consider four hypothetical eligible candidates with clearance values \(8, 9, 11,\) and \(12\) L/h, and EC50 values \(4.0, 4.5, 5.5,\) and \(6.0\) nM. A selection procedure returns four different virtual patients with clearance values \(9.9, 10.0, 10.0,\) and \(10.1\) L/h, and EC50 values \(4.95, 5.00, 5.00,\) and \(5.05\) nM.

Both populations have mean clearance \(10.0\) L/h and mean EC50 \(5.0\) nM, so they match those mean targets exactly. For the eligible candidates, the sample standard deviation of clearance is

$$ s_{\mathrm{candidate}} =\sqrt{\frac{(8-10)^2+(9-10)^2+(11-10)^2+(12-10)^2}{4-1}} =\sqrt{\frac{10}{3}} =1.83\ \mathrm{L/h}. $$

For the selected patients, it is

$$ s_{\mathrm{selected}} =\sqrt{\frac{(9.9-10)^2+(10-10)^2+(10-10)^2+(10.1-10)^2}{3}} =\sqrt{\frac{0.02}{3}} =0.0816\ \mathrm{L/h}. $$

The same calculation gives an EC50 standard deviation of \(0.913\) nM for the candidates and \(0.0408\) nM for the selected patients. The selected standard deviations are about \(4.5\%\) of the candidate values for both parameters. Thus, exact mean matching accompanies a striking contraction in parameter spread. This is a warning to investigate whether the contraction is intended and whether the selected parameter combinations remain scientifically plausible; it is not, by itself, proof that the selection is invalid.

Test Sensitivity to Individual Virtual Patients

A full-population summary can be stable-looking while depending heavily on one virtual patient. A direct check is to recalculate each important target after removing one patient at a time, without refitting or replacing that patient. This is a diagnostic perturbation, not a new population-construction procedure. Record how much each target summary changes and whether it crosses its tolerance or leaves its allowed range.

For a target that is the arithmetic mean of values \(x_1,\ldots,x_n\), the change caused by removing patient \(i\) has a simple expression. Since \(n\bar{x}=\sum_{k=1}^{n}x_k\), the mean after removal is \(\bar{x}_{(-i)}=(n\bar{x}-x_i)/(n-1)\). Subtracting the original mean gives:

$$ \bar{x}_{(-i)}-\bar{x} =\frac{n\bar{x}-x_i}{n-1}-\bar{x} =\frac{\bar{x}-x_i}{n-1}. $$

This derivation shows why a patient far from the mean can have greater influence, and why the same deviation matters more when \(n\) is small. For medians, quantiles, proportions, or nonlinear model outputs, recalculate the summary directly; the mean formula does not apply. Also inspect changes to more than one target, because the same patient may support several target matches.

Worked Example: Leave-One-Patient-Out Sensitivity

Four hypothetical virtual patients have values \(8, 9, 10,\) and \(13\) for a model-derived response summary in percentage points. The target mean is \(10\) percentage points, with tolerance \(1\) percentage point. The full-population mean is \((8+9+10+13)/4=10\), giving a raw residual of \(0\) and a scaled residual of \(0/1=0\).

Recalculate the mean after removing each patient:

  • Remove \(8\): \((9+10+13)/3=10.667\), a target residual of \(+0.667\) percentage points.
  • Remove \(9\): \((8+10+13)/3=10.333\), a target residual of \(+0.333\) percentage points.
  • Remove \(10\): \((8+9+13)/3=10.000\), a target residual of \(0\) percentage points.
  • Remove \(13\): \((8+9+10)/3=9.000\), a target residual of \(-1.000\) percentage point.

The largest leave-one-out change from the full mean is \(1.000\) percentage point, equal to the stated tolerance. The full-population residual of zero therefore hides a match that reaches the tolerance boundary when patient \(13\) is omitted. This flags sensitivity; it does not show that patient \(13\) is erroneous. The patient could be scientifically important, so the result should prompt review of the target, the patient, and the construction choices.

Combine the Diagnostics and Choose a Response

The diagnostics answer different questions. Target residuals show which specified summaries are mismatched. Parameter-spread comparisons show whether the selected patients retain relevant variation. Leave-one-out checks show whether the match is sensitive to a particular member. No single diagnostic substitutes for the others. For example, residuals may be small while parameter spread collapses, or spread may look reasonable while one target depends on a single patient.

1
Set reference scales and targets.
Document each target's value or allowed range, units, and tolerance or other scale before evaluating the selected population.
2
Inspect target residuals individually.
Calculate raw and scaled residuals, identify the largest discrepancies, and avoid letting an aggregate score conceal one poorly matched target.
3
Compare parameter spread.
Compare selected and reference populations on relevant parameters and joint patterns, interpreting changes in the context of the constraints.
4
Perturb membership.
Recalculate key summaries after omitting each patient in turn and flag changes that are large relative to the target's stated tolerance or range.
5
Review, do not mechanically reject.
Investigate flagged discrepancies, check sensitivity to reasonable construction choices, and report the limitations if the available information cannot distinguish a fragile match from a scientifically justified one.

These checks complement, rather than replace, other approaches. Optimization scores efficiently rank populations but can obscure individual residuals or diversity loss. Hard acceptance ranges make requirements transparent but do not guarantee that the accepted population is stable. Where suitable independent information exists, evaluating against targets not used to tune the population can provide a useful check on generalization; however, a withheld summary is not independent evidence if it is derived from the same data or closely duplicates a tuning target.

A practical report should state the targets and scales used, show notable residuals, describe how parameter spread was assessed, and summarize the largest leave-one-out changes. There is no universal cutoff for declaring overfit. Conclusions depend on target quality, parameter meaning, candidate-population design, and the purpose of the virtual population. In particular, passing these diagnostics does not establish coverage of every plausible patient type or validate predictions outside the information used to construct the population.

Common Mistake

Pitfall: “Every target residual is nearly zero, so the small virtual population is representative.”

Correction: Small residuals establish close agreement with the chosen summaries only. Check whether important parameter variation has contracted and whether removing one patient materially changes the match. Report these as separate pieces of evidence rather than treating target fit as proof of representativeness.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A target is \(20\) mg/L, the generated summary is \(18\) mg/L, and the prespecified tolerance is \(4\) mg/L. What are the raw and scaled residuals?
  2. Two populations match the same parameter mean, but one has a much smaller standard deviation. What can be concluded, and what cannot be concluded from that fact alone?
  3. For three virtual patients with values \(4, 6,\) and \(8\), calculate the full mean and all three leave-one-out means. Which omission changes the mean most?
  4. Why should an aggregate squared-residual score be accompanied by inspection of the individual residuals?

Solutions. (1) The raw residual is \(18-20=-2\) mg/L. The scaled residual is \(-2/4=-0.50\), so the generated summary is half a tolerance below the target. (2) The smaller standard deviation indicates less spread in that parameter in the population being compared. It may be a warning of contraction, but it does not prove overfitting: selection may legitimately restrict spread, and one marginal standard deviation does not describe the joint parameter structure. (3) The full mean is \((4+6+8)/3=6\). Omitting \(4\) gives \((6+8)/2=7\); omitting \(6\) gives \((4+8)/2=6\); omitting \(8\) gives \((4+6)/2=5\). Omitting either endpoint changes the mean by \(1\), the largest change. (4) Squaring and averaging can allow several small residuals to mask one large mismatch. Individual residuals show which target is poorly matched and preserve its units and context.

Clinical Biostats