Tutorials › Physiologically-Based Pharmacokinetics (PBPK) › Designing and Checking Sobol Simulations

Sensitivity Analysis and Parameter Reduction · Tutorial 731 of 799

Designing and Checking Sobol Simulations

Build a reproducible independent-input design for Sobol analysis, calculate indices from model evaluations, and check whether finite-simulation error makes the results unreliable.

Advanced 12 min read

What You'll Learn

  • Transform independent parameter samples to the specified PBPK input distributions
  • Construct A, B, and hybrid matrices and count the required model evaluations
  • Calculate first-order and total-effect estimates from model outputs
  • Recognize noisy, unstable, or invalid estimates as diagnostics, not findings
  • Check convergence using increasing sample sizes and independent replicate designs
  • Distinguish ordinary Monte Carlo error from model failures and solver problems

From Sobol Definitions to a Reproducible Simulation

Sobol indices describe how uncertainty in model inputs contributes to the variance of an output under specified input distributions. Their definitions are population quantities; a PBPK analysis obtains estimates by evaluating the model at a finite collection of sampled parameter sets. Designing that collection well is essential: a formula cannot recover reliable indices from a biased, dependent, or inadequately sized sample.

Consider a deterministic PBPK model with \(d\) uncertain parameters and a scalar output \(Y=f(X_1,\ldots,X_d)\), such as the predicted area under the concentration–time curve in a stated dose scenario. The simulation design in this tutorial assumes the input parameters are mutually independent, their probability distributions have been specified, and the output has finite, nonzero variance. The model, dose, scenario, endpoint, units, and solver settings are held fixed throughout the design. The indices therefore describe this output under these distributions and conditions; they are not universal properties of the model.

Definition: A Sobol simulation design uses two independent sample matrices, \(A\) and \(B\), each with \(N\) rows and \(d\) columns. Each row is a draw from the joint input distribution. For parameter \(i\), the hybrid matrix \(A_B^{(i)}\) equals \(A\) in every column except column \(i\), which is taken from \(B\). Evaluating the model at all rows of these matrices supplies paired outputs for estimating sensitivity indices.

To construct a row, first generate independent draws from convenient base distributions, often uniform draws on \([0,1]\), and transform each column using the inverse cumulative distribution function of its specified parameter distribution. For example, a positive parameter may use a lognormal distribution if that is the declared uncertainty model. The transformation must preserve the specified marginal distribution. Generating independent columns is appropriate only under the independence assumption; it does not establish that independence is scientifically justified.

Constructing the Matrices

The two base matrices must be sampled independently from one another, and rows within each matrix must follow the intended joint distribution. For ordinary Monte Carlo, rows are independent random draws. A space-filling or randomized low-discrepancy design can be used instead, but its randomization and analysis must be specified; a low-discrepancy sequence is not a substitute for defining the input distributions. In either case, the same row index must be kept together across \(A\), \(B\), and every hybrid when forming estimators.

Worked Example: Building a Small Two-Parameter Design

Suppose a hypothetical PBPK analysis varies two independent parameters: hepatic intrinsic clearance \(X_1\), in L/h, and fraction unbound \(X_2\), dimensionless. For this illustration, each is sampled uniformly over its declared interval: 2–6 L/h for \(X_1\), and 0.01–0.05 for \(X_2\). The following are hypothetical base draws on the unit interval; \(N=3\) is shown only to make the construction visible.

Row\(U_{A,1}\)\(U_{A,2}\)\(U_{B,1}\)\(U_{B,2}\)
10.100.800.600.20
20.500.300.200.90
30.900.600.800.40

For a uniform distribution from \(a\) to \(b\), transform a base draw \(u\) as \(a+(b-a)u\). Thus row 1 of \(A\) is \((2+4(0.10),\,0.01+0.04(0.80))=(2.4\text{ L/h},\,0.042)\), while row 1 of \(B\) is \((4.4\text{ L/h},\,0.018)\). The first hybrid replaces only the clearance column, so row 1 of \(A_B^{(1)}\) is \((4.4\text{ L/h},\,0.042)\). The second replaces only the unbound-fraction column, giving row 1 of \(A_B^{(2)}=(2.4\text{ L/h},\,0.018)\).

The same replacements are performed for each row, without reordering or pairing rows differently. With \(d=2\), the basic design requires \(N(d+2)=3(4)=12\) model evaluations: three each for \(A\), \(B\), and the two hybrid matrices. In a real analysis, \(N=3\) would be far too small for stable conclusions; this example illustrates construction and computational cost only.

In general, the base design with \(A\), \(B\), and one hybrid per parameter requires \(N(d+2)\) model evaluations. If the model is expensive, this cost should be planned before running it. Reusing a single matrix or changing the row pairing after the runs breaks the intended estimator structure. Record the random seed or design-generation settings, parameter transformations, row order, model version, solver tolerances, and output extraction procedure.

Estimating First-Order and Total-Effect Indices

Let \(Y_A\), \(Y_B\), and \(Y_{A_B^{(i)}}\) denote the vectors of \(N\) model outputs from the corresponding matrices. The first-order index \(S_i\) measures the fraction of output variance attributable to parameter \(i\) alone, while the total-effect index \(S_{T_i}\) includes its contribution through interactions with other inputs. The following estimators use the matrix convention just defined. They are finite-sample estimates, not exact identities for a particular finite design.

$$ \widehat{S}_i = \frac{\frac{1}{N}\sum_{r=1}^{N}Y_{B,r} \left(Y_{A_B^{(i)},r}-Y_{A,r}\right)} {\widehat{V}} \qquad \widehat{S}_{T_i} = \frac{\frac{1}{2N}\sum_{r=1}^{N} \left(Y_{B,r}-Y_{A_B^{(i)},r}\right)^2} {\widehat{V}} $$

Here \(\widehat{V}\) is an estimate of the output variance, obtained consistently for all parameters from the simulated outputs. One simple choice is the empirical variance of the \(2N\) outputs pooled from \(A\) and \(B\), with divisor \(2N\) when treating the simulated collection as the variance estimate. Other established estimator conventions use different variance normalizations or index formulas; do not combine a numerator from one convention with a denominator from another. The convention and variance estimate should be reported.

The first-order numerator compares the model output under \(B\) with the output in which only parameter \(i\) is switched to its \(B\) value while the other parameters come from \(A\). Under independent inputs, its expectation is the variance of the conditional mean of \(Y\) given \(X_i\). The total-effect numerator instead measures the squared output difference after all inputs except \(i\) are held at the matched \(B\) values. Its expectation, after division by \(2\), is the variance contribution not explained by holding \(X_i\) fixed. These identities explain why input independence and matched rows matter.

Justification: Write \(m_i(x)=E(Y\mid X_i=x)\). In the first-order product, \(Y_B\) and \(Y_{A_B^{(i)}}\) share \(X_i\), while their other inputs are independent draws. Conditioning on the shared \(X_i\), the expected product is \(m_i(X_i)^2\); the product involving \(Y_B Y_A\) has expectation \(E(Y)^2\), since those full draws are independent. Their difference is therefore \(\operatorname{Var}(m_i(X_i))\). For the total-effect difference, the two outputs share all inputs except \(X_i\); conditional on the shared inputs, the expected squared difference is twice the conditional variance with respect to \(X_i\). Averaging gives twice the total-effect variance contribution. Dividing each expected numerator by \(\operatorname{Var}(Y)\) yields the corresponding index.

Worked Example: Calculating Indices From Model-Run Summaries

Suppose a hypothetical analysis uses \(N=10{,}000\) rows for a scalar predicted \(C_{\max}\), measured in mg/L. For one parameter, the model runs produce a pooled variance estimate \(\widehat{V}=4.00\;(\text{mg/L})^2\). The sample mean of the products \(Y_{B,r}(Y_{A_B^{(i)},r}-Y_{A,r})\) is \(1.68\;(\text{mg/L})^2\), and the sample mean of the squared differences \((Y_{B,r}-Y_{A_B^{(i)},r})^2\) is \(4.72\;(\text{mg/L})^2\). These are hypothetical summaries of paired model runs.

The first-order estimate is

$$ \widehat{S}_i=\frac{1.68}{4.00}=0.420 $$

The total-effect estimate is

$$ \widehat{S}_{T_i}=\frac{4.72/2}{4.00} =\frac{2.36}{4.00}=0.590 $$

For this design and output, the estimates suggest that the parameter accounts for about 42.0% of the output variance through its first-order contribution and about 59.0% when its interactions are included. The difference, \(0.590-0.420=0.170\), is consistent with a possible contribution from interactions, but sampling uncertainty must be assessed before drawing a strong conclusion. The estimates are dimensionless; the variance quantities in the numerator and denominator have matching squared-output units.

In the population, the usual independent-input Sobol indices lie between zero and one, and the total-effect index is at least as large as the first-order index. Finite-sample estimates need not obey either constraint. A negative first-order estimate or a total-effect estimate above one can occur from Monte Carlo error, especially at small \(N\) or when output variance is poorly estimated. Do not silently truncate such estimates to zero or one: truncation hides a diagnostic signal and changes the estimator.

Checking Monte Carlo Error and Convergence

A single run at a single sample size does not demonstrate convergence. For ordinary Monte Carlo, a practical check is to calculate estimates at increasing \(N\) and compare them with estimates from independent designs. A batch or replicate approach gives a direct view of between-design variation: generate multiple independent designs, calculate the indices for each, and inspect the spread and stability of the estimates. This spread is a diagnostic for simulation error, not a guarantee that the design has explored every relevant model feature.

Worked Example: Assessing Stability Across Independent Designs

Suppose three independent hypothetical designs are run at \(N=5{,}000\), \(10{,}000\), and \(20{,}000\) rows per base matrix. The table shows estimates of the first-order index for clearance and the total-effect index for the same parameter.

\(N\)First-order estimates across three designsTotal-effect estimates across three designs
5,0000.38, 0.44, 0.410.56, 0.64, 0.60
10,0000.40, 0.42, 0.410.58, 0.62, 0.60
20,0000.405, 0.415, 0.4100.590, 0.610, 0.600

At \(N=20{,}000\), the replicate means are \((0.405+0.415+0.410)/3=0.410\) for the first-order index and \((0.590+0.610+0.600)/3=0.600\) for the total-effect index. The ranges across these three designs are 0.010 and 0.020, respectively. Both estimates become more tightly clustered as \(N\) increases, which is evidence of improving simulation stability. It is not proof of exact convergence: three replicates provide only a limited assessment, and the acceptable precision depends on the intended decision.

Useful diagnostics include the index estimate versus \(N\), replicate-to-replicate spread, the output variance estimate, and the first-order and total-effect estimates together. Investigate estimates that drift substantially with increasing \(N\), fluctuate widely across independent designs, or repeatedly violate expected population relationships. If a parameter’s total-effect estimate is close to zero, its squared-difference numerator can be particularly sensitive to numerical noise. A flat convergence plot can also be misleading if every design shares the same coding error, wrong distribution, or inadequate parameter range.

For a deterministic PBPK model, repeat evaluations at selected parameter sets when numerical solver error may be consequential. If the same inputs produce materially different outputs, resolve solver tolerances, event handling, or stochastic simulation noise before interpreting design-to-design variability as Monte Carlo error. Failed or non-finite model evaluations must be investigated. Dropping those rows without a prespecified treatment can change the sampled input distribution and bias the indices; report the failure pattern and address its cause or justify an explicit model-domain rule.

Alternatives, Limitations, and Common Mistakes

A direct variance-decomposition calculation is conceptually simple but usually needs many model evaluations as the number of parameters grows. The A–B hybrid design reuses runs to estimate effects efficiently and supports first-order and total-effect estimates from a common sample. A randomized low-discrepancy design may improve coverage for some problems, while ordinary independent Monte Carlo has a straightforward replicate-based error assessment. Neither design is universally superior: assess actual stability, preserve the required matrix structure, and document the method. The phrase “Sobol sequence” refers to one kind of low-discrepancy sampling sequence; it is distinct from the Sobol sensitivity indices.

These estimators rely on a correctly specified joint input distribution, in particular the independence assumption used in the derivation. They also require finite, nonzero output variance. If the output is constant over the sampled domain, the denominator is zero and variance-based indices are undefined. Results can be misleading if input ranges or probability distributions do not represent the uncertainty of interest, if the model has unhandled failures, or if the sample is too small for a rare but influential region. A scalar endpoint’s indices also need not describe another endpoint or a different dose scenario.

  • Mistake: treating one set of indices as converged because the calculation completed. Completion means the model ran; it does not establish adequate precision. Compare increasing sample sizes and independent designs.
  • Mistake: interpreting a finite-sample estimate outside zero to one as a true negative contribution. Population indices under the stated assumptions are nonnegative and bounded, but noisy estimates can fall outside those limits. Report the diagnostic and assess stability rather than silently clipping.
  • Mistake: permuting hybrid rows or using correlated columns while applying independent-input formulas. These changes invalidate the estimator’s pairing or assumptions. Preserve row alignment and use a method appropriate to the actual joint distribution.
  • Mistake: treating failed runs as harmless missing values. Failure can depend on parameter values and therefore alter the sampled domain. Diagnose failures and document any justified treatment.
Key takeaway: A Sobol estimate is only as interpretable as its input distributions, matrix construction, model evaluations, and convergence checks. Report the design size, estimator and variance convention, output definition, failure handling, and evidence that estimates are stable enough for their intended use.

Check Your Understanding

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

  1. For \(d=8\) uncertain independent parameters and \(N=2{,}000\), how many model evaluations are required for \(A\), \(B\), and one hybrid per parameter?
  2. In \(A_B^{(3)}\), which columns come from \(B\), and why must the row pairing be preserved?
  3. A first-order estimate is \(-0.03\) while its total-effect estimate is 0.12. Is the negative estimate evidence of a negative population variance contribution?
  4. Why is a single estimate at \(N=50{,}000\) not, by itself, a convergence check?
  5. A deterministic model produces a solver failure for a subset of high-clearance samples. Why is simply removing those rows potentially problematic?

Solutions. (1) The cost is \(N(d+2)=2{,}000(8+2)=20{,}000\) model evaluations. (2) Only column 3 comes from \(B\); all other columns come from \(A\). The matched row supplies the shared inputs needed by the estimator, so re-pairing rows changes the intended comparisons. (3) No. Under the stated independent-input assumptions, the population first-order index is nonnegative; \(-0.03\) can reflect finite-sample error or another design or computation problem and should prompt diagnostics. (4) One sample size supplies no evidence about how the estimate changes with \(N\) or across independent designs. Compare larger sample sizes and replicate designs. (5) Removing failures may preferentially exclude a region of the input distribution, changing the effective sample and biasing the estimated indices. Investigate the cause, define any valid model domain explicitly, and report the treatment.