Tutorials › Quantitative Systems Pharmacology (QSP) › Preserving Joint Structure During Subsampling

Virtual Patient Generation · Tutorial 711 of 799

Preserving Joint Structure During Subsampling

Learn when random, stratified, or constrained subsampling is appropriate, and how to preserve subgroup representation and important joint structure without assuming a small subset will reproduce it exactly.

Advanced 12 min read

What You'll Learn

  • Explain why random subsampling can change observed correlations and joint proportions in a finite subset.
  • Calculate the expected count and sampling variability of a joint category under simple random sampling without replacement.
  • Choose stratum quotas to retain specified subgroup proportions.
  • Formulate feasible joint-cell constraints and understand what they do—and do not—preserve.
  • Compare random, stratified, and constrained selection in terms of representativeness, precision, and feasibility.
  • Identify practical warning signs such as empty cells, excessive selection concentration, and unintended changes in subgroup composition.

Why Subsampling Can Change a Virtual Population

An existing virtual-patient ensemble may contain more individuals than are needed for a simulation or analysis. Subsampling reduces computational cost, but a small subset can differ from its source ensemble in important ways. Even when every patient has the same chance of selection, the subset may have different subgroup proportions, correlations, or joint phenotype frequencies simply because it contains fewer individuals.

The goal is not necessarily to make every sample statistic identical to the source ensemble. It is to select a subset that retains the features important for the intended use, while avoiding avoidable selection bias. The earlier material on why matching marginals can distort joint structure is relevant here: matching separate variable distributions does not automatically preserve how those variables occur together. Subsampling requires the same attention to joint structure.

Definition: Subsampling is selecting \(n\) individuals from a finite ensemble of \(N\) individuals, usually without replacement, so that no individual appears more than once in the subset. Joint structure refers to how characteristics co-occur across individuals, including associations between variables and frequencies of combinations such as joint phenotypes.

A selection design should be specified before interpreting the resulting subset. Simple random sampling gives each subset of size \(n\) the same probability of selection. Stratified sampling first divides the ensemble into defined subgroups and selects a specified number from each. Constrained selection chooses a subset subject to requirements such as fixed subgroup counts or joint-cell counts. These designs answer different needs; none guarantees that every feature of the source ensemble will be retained.

What Random Subsampling Preserves in Expectation

Under simple random sampling without replacement, each individual has inclusion probability \(n/N\). Thus, for a category represented by \(K\) of the \(N\) individuals, the expected number selected is \(nK/N\). This is an expectation over repeated subsets, not a promise that one particular subset will contain that number.

The variability of a category count can be substantial in a small subset. If the category proportion in the finite ensemble is \(p=K/N\), then its count \(X\) in a simple random sample without replacement has a hypergeometric distribution, with variance and standard deviation:

$$ E(X)=np,\qquad \operatorname{Var}(X)=np(1-p)\frac{N-n}{N-1},\qquad SD(X)=\sqrt{np(1-p)\frac{N-n}{N-1}}. $$

The factor \((N-n)/(N-1)\) is the finite-population correction: sampling without replacement produces less variability than independent sampling with replacement. The formula describes a single category count. Correlations and other joint summaries are calculated from several counts together, so they can fluctuate even when each individual has equal selection probability.

Worked Example: A Joint Cell Under Random Subsampling

Suppose a hypothetical ensemble has \(N=1{,}000\) virtual patients. Binary characteristics \(A\) and \(B\) have the following joint counts: \(A=1,B=1\): 360; \(A=1,B=0\): 140; \(A=0,B=1\): 240; and \(A=0,B=0\): 260. A simple random subset of \(n=100\) is drawn without replacement.

In the source ensemble, \(P(A=1)=500/1{,}000=0.50\), \(P(B=1)=600/1{,}000=0.60\), and \(P(A=1,B=1)=0.36\). The source correlation is:

$$ r_{AB}= \frac{0.36-(0.50)(0.60)} {\sqrt{(0.50)(0.50)(0.60)(0.40)}} =\frac{0.06}{\sqrt{0.06}} \approx 0.245. $$

The expected number of \(A=1,B=1\) patients in the subset is \(100(360/1{,}000)=36\). Its standard deviation is:

$$ SD(X)=\sqrt{100(0.36)(0.64)\frac{900}{999}} =\sqrt{20.7568} \approx 4.556\text{ patients}. $$

For illustration, one possible realized subset has joint counts \((40,10,13,37)\), in the cell order given above. Its \(A=1\) margin is 50 patients and its \(B=1\) margin is 53 patients; the margins are not both 50. The subset proportions are therefore \(P(A=1)=0.50\), \(P(B=1)=0.53\), and \(P(A=1,B=1)=0.40\). Its correlation is:

$$ r_{AB}= \frac{0.40-(0.50)(0.53)} {\sqrt{(0.50)(0.50)(0.53)(0.47)}} = \frac{0.135}{\sqrt{0.062275}} \approx 0.541. $$

This realized correlation is noticeably larger than the source correlation, despite unbiased random selection. It illustrates sampling fluctuation, not evidence that random sampling systematically increases the association. In repeated random subsets, joint counts vary around their source-based expectations.

Stratified Selection for Subgroup Proportions

When subgroup composition matters, stratification makes the subgroup counts part of the design rather than leaving them to chance. Define mutually exclusive strata, decide the desired count from each, and then select individuals within each stratum. Proportional allocation uses the source proportions: if stratum \(h\) contains \(N_h\) individuals, its proportional quota is \(n_h=nN_h/N\), subject to integer rounding.

Stratification fixes the selected counts in the specified strata, but does not fix associations within a stratum or between variables that were not used to define the strata. If an important joint pattern is not represented by the stratification variables, its frequency can still drift. If quotas are not proportional to the source composition, the subset may be deliberately disproportionate; estimates intended to represent the source then need appropriate stratum weights.

Worked Example: Preserving a Subgroup Proportion

A hypothetical ensemble has 300 patients in subgroup \(C=1\) and 700 in subgroup \(C=0\). A subset of 100 is needed, and the aim is to retain the source subgroup proportions. Proportional quotas are:

$$ n_1=100\frac{300}{1{,}000}=30,\qquad n_0=100\frac{700}{1{,}000}=70. $$

Selecting 30 patients from \(C=1\) and 70 from \(C=0\) makes the subset proportions exactly 30% and 70%. By contrast, a simple random subset might contain 24 and 76, giving a \(C=1\) proportion of 24%. Stratification removes this particular source of subgroup-count fluctuation, but selection within each stratum is still variable.

Suppose the source stratum means for a hypothetical outcome \(Y\) are 8 units for \(C=1\) and 4 units for \(C=0\), while the selected patients have stratum means 8.4 and 3.8 units. The source-composition-weighted subset mean is:

$$ 0.30(8.4)+0.70(3.8)=2.52+2.66=5.18\text{ units}. $$

The corresponding source mean from the stated stratum means is \(0.30(8)+0.70(4)=5.20\) units. The small difference remains because the selected patients within strata need not reproduce their stratum means exactly. Fixed subgroup proportions do not imply exact preservation of every outcome distribution.

Constrained Selection for Joint Structure

When particular combinations of characteristics must be retained, selection constraints can target joint cells directly. For a cross-classification, let \(x_{ab}\) be the selected count in cell \((A=a,B=b)\). Counts must be nonnegative integers, sum to \(n\), and satisfy any specified margins or cell quotas. Feasibility matters: the required count in a cell cannot exceed the number of available individuals in that cell.

Worked Example: Enforcing Joint-Cell Counts

Use the same hypothetical source table as before, with cell counts \((360,140,240,260)\), and select 100 patients. Suppose the design requires exactly 50 with \(A=1\), exactly 60 with \(B=1\), and aims to keep the source joint-cell proportions. The source proportions imply the integer cell targets \((36,14,24,26)\), which sum to 100. They also meet both margins: \(36+14=50\) for \(A=1\), and \(36+24=60\) for \(B=1\).

These quotas are feasible because no requested count exceeds its available source-cell count. Selecting those counts preserves the table proportions exactly in the subset: \(36/100=0.36\), \(50/100=0.50\), and \(60/100=0.60\). If selection within each cell is random, it avoids choosing only unusual members of a cell by a deterministic rule. In this example, every cell has the same selection fraction, \(0.10\).

Integer quotas will not always match source proportions exactly, and constraints on one cross-classification do not preserve unlisted relationships. For continuous variables, preserving a correlation may require constraints on a statistic such as a cross-product or on joint bins; matching a correlation alone does not preserve the full joint distribution. More constraints can also make the problem infeasible or leave too few choices for meaningful variation within cells.

A constrained design can be implemented by defining a feasible set of subsets, then selecting within that set. For example, an optimization objective may penalize deviations from target subgroup or joint-cell counts while enforcing availability limits. The earlier material on optimization-based virtual population selection provides context for such objectives. Regardless of the algorithm, inspect whether the constraints express the intended scientific priorities, and whether the selected individuals remain diverse within the allowed cells.

Choosing a Design and Checking Its Limits

DesignWhat it controls directlyMain limitation
Simple randomEqual selection chance for each individual; counts are correct on average across repeated samplesSubgroup and joint counts can fluctuate in one realized subset
StratifiedCounts in predefined strataUnconstrained associations and within-stratum distributions can still vary
ConstrainedSpecified margins, joint cells, or other explicit conditionsMay be infeasible, overly restrictive, or distort unconstrained features if the selection rule is not careful

Before using a subset, verify the selected count, subgroup proportions, and the joint features that motivated the design. Check that requested counts were feasible and that the implementation actually met the constraints. For random or within-stratum random selection, compare observed counts with their expected sampling variation rather than treating every difference as a design failure. Also check for duplicated patients, accidental exclusions, or a small number of individuals dominating a weighted or optimization-based selection.

A frequent mistake is to conclude that a random subset preserves correlations because each patient had an equal chance of selection. Equal inclusion probabilities support unbiasedness over repeated samples; they do not make the realized subset’s correlation equal to the source correlation. The correction is to distinguish long-run expectation from one subset’s finite-sample result, quantify plausible count variation where useful, and constrain or stratify only the features that genuinely need tighter control.

A second pitfall is to equate exact subgroup proportions with preserved joint structure. Fixing the number of patients in each age group, for instance, does not fix how disease status and treatment response co-occur within those age groups. Conversely, exact joint-cell quotas preserve those particular cell frequencies but do not guarantee the distribution of continuous variables within cells. Every selection design has a scope: state what it controls, and do not infer preservation of features it did not constrain.

Key takeaway: Use simple random sampling when representativeness across repeated subsets is sufficient, stratify when specified subgroup counts must be controlled, and use joint constraints when particular co-occurrences matter. In each case, preserve diversity within the design and verify the resulting subset against the features that motivated selection.

Check Your Understanding

Work through these questions, then compare your reasoning with the solutions.

  1. A source ensemble has 500 patients, of whom 100 have a phenotype. A simple random subset of 50 is taken without replacement. What is the expected phenotype count and its approximate standard deviation?
  2. A subgroup makes up 40% of a source ensemble, and the desired subset size is 80. What proportional quota should be assigned to that subgroup? What does this quota guarantee?
  3. A 60-patient subset has joint-cell counts \(x_{11}=18\), \(x_{10}=12\), \(x_{01}=7\), and \(x_{00}=23\), where the subscripts denote \(A\) and \(B\). Calculate the margins and the binary correlation.
  4. Why does fixing exact joint-cell counts for two categorical variables not guarantee preservation of a continuous biomarker’s distribution within those cells?
  5. A source population has stratum proportions 30% and 70%, but a subset deliberately allocates 40% and 60%. If the selected stratum means are 10 and 4 units, calculate the source-composition-weighted mean and explain why the unweighted subset mean differs.

Solutions. (1) The phenotype proportion is \(p=100/500=0.20\), so \(E(X)=50(0.20)=10\) patients. The standard deviation is \(\sqrt{50(0.20)(0.80)(450/499)}=\sqrt{7.2144}\approx2.686\) patients. (2) The quota is \(80(0.40)=32\) patients. It guarantees the specified subgroup count and 40% subset proportion, not the subgroup’s internal joint distributions. (3) The \(A=1\) margin is \(18+12=30\), and the \(B=1\) margin is \(18+7=25\). Thus \(p_A=30/60=0.50\), \(p_B=25/60\approx0.4167\), and \(p_{11}=18/60=0.30\). The correlation is \(\{0.30-(0.50)(0.4167)\}/\sqrt{(0.50)(0.50)(0.4167)(0.5833)}\approx0.372\). (4) The cell constraints specify categorical counts only; continuous biomarker values can still be unusually high, low, or unevenly distributed within a cell. (5) The correctly weighted mean is \(0.30(10)+0.70(4)=5.8\) units. The unweighted subset mean is \(0.40(10)+0.60(4)=6.4\) units because it reflects the subset’s deliberately different stratum proportions rather than the source composition.

Clinical Biostats