Tutorials › Quantitative Systems Pharmacology (QSP) › Conditional Virtual Populations For Subgroups

Virtual Patient Generation · Tutorial 700 of 799

Conditional Virtual Populations For Subgroups

Learn to define subgroup-specific virtual populations as conditional distributions, generate them by direct sampling or filtering, and check their composition without confusing subgroup fit with population prevalence.

Advanced 12 min read

What You'll Learn

  • Define a subgroup as an event on a joint virtual-patient trait vector.
  • Distinguish subgroup composition from the subgroup’s prevalence in the full population.
  • Use conditional sampling or rejection sampling while preserving dependence among traits.
  • Calculate subgroup probabilities and conditional composition from joint probabilities.
  • Verify eligibility rules, subgroup counts, and categorical composition.
  • Diagnose rare-subgroup and independent-marginal sampling failures.

Why Condition on the Joint Patient Profile?

A virtual population intended to represent a clinical or mechanistic subgroup must reproduce the distribution of patient profiles within that subgroup. For example, a subgroup defined by a biomarker threshold may differ from the full population not only in the biomarker itself, but also in correlated parameters, categorical phenotypes, and other traits. Sampling those traits independently from their population-wide distributions can therefore produce profiles that do not represent the subgroup.

The central object is a conditional distribution. It describes virtual patients given that they meet a specified eligibility rule or phenotype definition. It is distinct from the prevalence of that subgroup in the overall population: a population designed to contain 500 subgroup members need not imply that the subgroup makes up 500 of every 1,000 patients.

Definition: Let \(V\) denote the joint vector of traits and mechanistic parameters for a virtual patient, with target population distribution \(F_V\). Let \(S\) be a specified subgroup event, such as satisfying an eligibility rule or phenotype definition. The subgroup-specific virtual population targets the conditional distribution \(F_{V\mid S}\), the distribution of the full vector \(V\) among patients for whom \(S\) occurs. This distribution is defined only when \(P(S)>0\).

A subgroup event may combine continuous and categorical criteria. For example, \(S\) might require a biomarker \(X\) to exceed a threshold, a categorical phenotype \(C\) to equal a specified level, and a physiological parameter to lie within an admissible range. Define the event before generating the subgroup, including units, threshold inclusivity, and how missing or undefined values are handled.

What Conditioning Does to the Joint Distribution

For a continuous trait vector with joint density \(f_V(v)\), conditioning on an event changes the density to

$$ f_{V\mid S}(v)=\frac{f_V(v)\,\mathbf{1}\{v\in S\}}{P(S)}. $$

Here \(\mathbf{1}\{v\in S\}\) is 1 for profiles that meet the definition and 0 otherwise. The denominator normalizes the density over the eligible region. For a discrete profile \(v\), the corresponding formula is \(P(V=v\mid S)=P(V=v,S)/P(S)\). In either case, conditioning applies to the joint profile, not to isolated marginals.

The practical consequence is important: even if two traits were associated in the full population, their association within a selected subgroup need not have the same form or strength. Selection changes which combinations of values are present. This is why matching population-wide marginal distributions separately is not a substitute for generating the conditional joint distribution.

Assumptions for conditional generation: The target joint distribution must represent the intended source population; the subgroup rule must be specified unambiguously; and the subgroup must have positive probability under that distribution. If a candidate population is used, its candidates must represent the target joint distribution closely enough for the intended use. In all methods, generated profiles must also satisfy the model’s physiological and mechanistic feasibility constraints.

Two Practical Routes to a Subgroup Population

If the conditional distribution is available directly, sample profiles from \(F_{V\mid S}\). In practice, that may require a model capable of sampling the joint traits conditional on the subgroup definition. A second route is rejection sampling: draw from the target full-population distribution and retain only profiles satisfying \(S\). The accepted profiles have the conditional distribution when the original draws are from \(F_V\), the rule is applied correctly, and the retained set is large enough for the intended use.

The rejection result follows directly from conditional probability. For any set of profiles \(A\), the probability that a draw is in \(A\) after retaining only draws in \(S\) is

$$ P(V\in A\mid V\in S)=\frac{P(V\in A,\ V\in S)}{P(V\in S)}. $$

This is exactly the probability assigned to \(A\) by the conditional distribution. Thus rejection sampling does not require independent sampling of the traits: it preserves their joint structure in the source draws while restricting them to \(S\). Its cost is that only a fraction \(P(S)\) of candidates is expected to be retained. When that probability is very small, filtering may be inefficient and the accepted set may be too small to describe the subgroup reliably.

Worked Example: Conditioning a Biomarker on an Eligibility Range

Suppose a hypothetical population has biomarker \(X\sim N(50,10^2)\), measured in units of concentration. Define eligibility as \(40\leq X\leq60\). Find the expected rejection-sampling yield and describe the conditional distribution being generated.

Standardizing the two limits gives \(z=(40-50)/10=-1\) and \(z=(60-50)/10=1\). Therefore the probability that a candidate is eligible is

$$ P(40\leq X\leq60)=\Phi(1)-\Phi(-1)=0.8413-0.1587=0.6826. $$

Using the more precise standard normal values gives approximately \(0.6827\). Thus, among 10,000 independent candidates from this hypothetical population, the expected number retained is \(10{,}000(0.6827)=6{,}827\). This is an expectation, not a guarantee of that exact count.

The resulting target is \(X\) conditional on \(40\leq X\leq60\), not the original normal distribution. By symmetry, half of the eligible probability lies below 50 and half above it. This simple example concerns one trait; if other traits are correlated with \(X\), they must be retained from the same accepted profiles rather than resampled independently.

Subgroup Composition Can Differ from Population Composition

A phenotype may be more common in some ranges of a continuous trait than in others. Conditioning on that phenotype consequently changes the distribution of the trait. The change can be calculated from joint probabilities, and it should be expected rather than treated as a sampling error.

Worked Example: A Phenotype Changes the Continuous-Trait Mix

In a hypothetical source population, 40% of patients have a low level of continuous trait \(X\) and 60% have a high level. A phenotype \(D=1\) occurs with probability 0.25 in the low group and 0.10 in the high group. Find the phenotype prevalence and the composition of the phenotype-positive subgroup.

The joint probabilities are \(P(\text{low},D=1)=0.40(0.25)=0.10\) and \(P(\text{high},D=1)=0.60(0.10)=0.06\). Therefore,

$$ P(D=1)=0.10+0.06=0.16. $$

Among phenotype-positive patients, the low-group fraction is \(P(\text{low}\mid D=1)=0.10/0.16=0.625\), and the high-group fraction is \(0.06/0.16=0.375\). A subgroup of 1,000 patients generated from this conditional distribution would therefore have expected counts of 625 low and 375 high, subject to Monte Carlo variation.

The full population is 40% low and 60% high, but the phenotype-positive subgroup is 62.5% low and 37.5% high. Sampling \(X\) according to the full-population mix and then assigning phenotype-positive status without respecting its dependence on \(X\) would fail to reproduce this conditional composition.

This distinction also clarifies how to report a generated subgroup. Its composition describes \(F_{V\mid S}\); it does not, by itself, describe how common \(S\) is in the source population. If the task also requires population prevalence, estimate or specify \(P(S)\) separately and retain it as a separate target.

Verify the Generated Subgroup

Verification begins with the definition, not with a summary statistic. First confirm that every retained profile satisfies each criterion and that no profile failing a criterion was included. Then check whether the subgroup has enough patients for its intended use and whether categorical composition agrees with the conditional target or with the reference data available for that subgroup. Also inspect whether combinations of traits remain plausible and feasible; a collection can meet separate marginal checks while containing implausible joint profiles.

For an unweighted independent sample of \(n_S\) profiles from a subgroup, a categorical proportion can be checked as \(\hat{p}_S=k/n_S\), where \(k\) is the number with the category of interest. Its approximate Monte Carlo standard error is \(\sqrt{\hat{p}_S(1-\hat{p}_S)/n_S}\). This measures variation from generating a finite random sample under the assumed conditional distribution; it is not evidence that the underlying target distribution is correct. The formula does not generally apply unchanged to weighted or dependent resampling.

Worked Example: Checking a Combined Eligibility and Phenotype Rule

A hypothetical candidate population contains 10,000 profiles. The subgroup rule is: phenotype \(A=1\) and biomarker \(X\geq30\) units. Applying both conditions retains 900 profiles. Of these, 540 have categorical trait \(C=1\), and 360 have \(C=0\). Calculate the yield and check the observed subgroup composition.

The rejection yield is \(900/10{,}000=0.09\), or 9.00%. The categorical composition among retained profiles is \(\hat{p}_S=540/900=0.600\) for \(C=1\), with \(360/900=0.400\) for \(C=0\). For these independent, equally weighted retained draws, the approximate Monte Carlo standard error for the \(C=1\) proportion is

$$ SE=\sqrt{\frac{0.600(1-0.600)}{900}} =\sqrt{0.0002667}=0.0163. $$

A rough two-standard-error range around the generated proportion is \(0.600\pm2(0.0163)\), or approximately 0.567 to 0.633. This range describes approximate Monte Carlo variation under the sampling assumptions; it is not a formal assessment of target-model validity. The rule audit must also confirm that all 900 profiles have \(A=1\) and \(X\geq30\), and that the 9% yield is a plausible consequence of the specified source distribution. If the intended conditional target assigns a substantially different \(C=1\) fraction, the generated composition warrants investigation.

Choosing a Method and Recognizing Failure

ApproachUseful whenMain concern
Direct conditional samplingA reliable model can sample the joint traits given the subgroup rule.The conditional sampler must represent dependence and enforce the rule correctly.
Rejection samplingThe full joint population can be sampled and the subgroup event is not too rare.Low subgroup probability leads to low yield and potentially too few accepted profiles.
Separate subgroup specificationSubgroup-specific target information is available and can be represented directly.Targets must be jointly coherent; independently specified traits may describe no plausible joint population.

A common mistake is to take the subgroup prevalence from the full population, then generate subgroup members by independently drawing each trait from its population-wide marginal distribution. The reasoning is wrong because knowing that a patient belongs to a subgroup changes the relevant distribution to \(F_{V\mid S}\); it does not leave every marginal unchanged. The correction is to sample or select the whole profile under the subgroup condition, then verify its composition.

Other warning signs include a conditional sampler that returns profiles outside the defining range, a filtering implementation that applies only some of the criteria, and a very small accepted set for a rare subgroup. A small sample can make estimated category proportions unstable even when the algorithm is correct. Conversely, exact compliance with the subgroup rule does not prove that the source population model or the subgroup’s joint distribution is scientifically adequate.

Conditional generation is useful when a QSP analysis concerns a defined patient segment, such as a phenotype-positive population or patients meeting a mechanistic eligibility rule. Its limitations follow from its inputs: the conditional population cannot be more reliable than the joint source model and subgroup definition on which it depends. Keep subgroup prevalence separate from subgroup composition, preserve complete patient profiles, and make the rule auditable.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. If a subgroup has probability 0.20 in the source population, what fraction of independent rejection-sampling candidates is expected to be retained?
  2. A subgroup is defined by \(A=1\) and \(X>5\). Why is it generally inappropriate to generate \(A\) and \(X\) independently from their full-population marginals?
  3. In a subgroup sample of 400 patients, 100 have phenotype \(C=1\). What is the observed proportion, and what is its approximate Monte Carlo standard error under independent, equally weighted sampling?
  4. Does generating 1,000 patients from \(F_{V\mid S}\) establish that the subgroup prevalence in the source population is 1,000 divided by the full population size? Explain.

Solutions. (1) The expected retained fraction is \(P(S)=0.20\), or 20%. (2) The subgroup rule may induce dependence or change the trait distributions; use the joint conditional distribution so that selected profiles and their relationships are preserved. (3) \(\hat{p}=100/400=0.25\), and \(SE=\sqrt{0.25(0.75)/400}=0.0217\), approximately. (4) No. The 1,000 profiles are a chosen subgroup sample size; source-population prevalence is \(P(S)\), which must be specified or estimated separately.

Clinical Biostats