Why Quantiles Need Their Own Monte Carlo Error
A PBPK simulation can produce a distribution of predictions by repeatedly drawing uncertain inputs and propagating them through the model. A reported median or prediction-distribution boundary is then estimated from a finite sample of simulated outcomes. Increasing the number of draws may change that estimate, even when the input distributions and PBPK model are unchanged. Monte Carlo error is this finite-simulation uncertainty in the estimated quantity; it is not the biological or predictive spread of the simulated outcomes themselves.
The error is especially important for quantiles. A mean averages information across the full sample, whereas a quantile depends on the outcomes near a particular rank. The uncertainty of a quantile estimate therefore depends both on sample size and on how densely outcomes lie near the target quantile. A tightly concentrated distribution near the median can yield a precise median, while a sparse tail can make a boundary estimate imprecise even with many simulations.
The empirical quantile convention above is one standard choice; software can use other interpolation rules, particularly when \(np\) is not an integer. The convention should be stated when reproducibility or small-sample comparisons matter. The large-sample approximations below apply to common quantile conventions under their regularity conditions.
Large-Sample Quantile Error
Suppose \(Y_1,\ldots,Y_n\) are independent draws from the same continuous distribution, and that the density \(f\) is positive and sufficiently smooth near \(q_p\). In particular, \(F(q_p)=p\) and \(f(q_p)>0\). For large \(n\), the quantile estimate is approximately normal around \(q_p\), with variance determined by the local density:
The units of \(f(q_p)\) are inverse units of \(Y\), so the MCSE has the same units as the prediction. For instance, if \(Y\) is a concentration in mg/L, its quantile MCSE is also in mg/L. This standard error quantifies simulation precision, not the width of a predictive interval.
This approximation requires more than a large total simulation count. The draws must be independent, or the dependence must be handled with an appropriate method; the target distribution must be adequately represented; and the density near the target quantile must be positive and reasonably smooth. A point mass, a sharp discontinuity, or a density close to zero can invalidate the approximation or make the quantile intrinsically difficult to estimate.
Estimating Error From Order-Statistic Spacings
The density \(f(q_p)\) is usually unknown. One practical approach estimates it from the span of nearby ordered outcomes. Let \(k=\lceil np\rceil\), choose a positive integer \(r\) such that \(k-r\) and \(k+r\) are valid indices, and estimate the local density by the probability mass between those ranks divided by their outcome-value span:
The spacing is an estimate of how much outcome value corresponds to a probability change of about \(2r/n\). A larger \(r\) gives a more stable spacing but averages density over a wider region; a smaller \(r\) is more local but can be noisy. The choice should be checked for sensitivity rather than treated as automatic.
Worked Example: MCSE of a Simulated Median
Suppose a hypothetical PBPK analysis produces \(n=10{,}000\) independent simulated peak concentrations, measured in mg/L. The estimated median is \(Y_{(5000)}=12.4\) mg/L. For a spacing estimate, use \(r=100\), with \(Y_{(4900)}=11.8\) mg/L and \(Y_{(5100)}=13.0\) mg/L.
The estimated density near the median is \( \hat f=(2r/n)/(Y_{(5100)}-Y_{(4900)})=(200/10{,}000)/(13.0-11.8)=0.0200/1.2=0.01667 \) per mg/L. For the median, \(p=0.5\), so the estimated MCSE is \( \sqrt{0.5(1-0.5)/10{,}000}/0.01667=0.005000/0.01667=0.300 \) mg/L.
The estimated median is therefore 12.4 mg/L with an estimated Monte Carlo standard error of 0.300 mg/L. This does not mean the simulated predictions typically lie within 0.300 mg/L of the median: it describes the sampling variability of the estimated median across repeated simulations of this size.
Worked Example: A Lower Prediction-Distribution Boundary
In a second hypothetical simulation, \(n=20{,}000\) independent outcomes are used to estimate the 2.5th percentile of a concentration prediction. Here \(p=0.025\), \(k=500\), and \(Y_{(500)}=2.10\) mg/L. With \(r=50\), suppose \(Y_{(450)}=1.98\) mg/L and \(Y_{(550)}=2.24\) mg/L.
The local density estimate is \( \hat f=(100/20{,}000)/(2.24-1.98)=0.005000/0.26=0.01923 \) per mg/L. The probability-scale factor is \( \sqrt{0.025(0.975)/20{,}000}=\sqrt{0.00000121875}=0.001104 \). Therefore, \( \widehat{\operatorname{MCSE}}=0.001104/0.01923=0.05741 \) mg/L.
This boundary estimate has a larger MCSE than the median in the previous example, despite using twice as many simulations. The density estimate differs between examples, so sample size alone does not determine quantile precision. The result is an approximate MCSE; it should be treated cautiously if nearby spacings or alternative choices of \(r\) produce substantially different values.
Estimating Error With Independent Batches
A second approach divides independent simulation draws into \(B\) batches of equal size \(m\), so \(n=Bm\), and calculates the same quantile separately in each batch. If the batch estimates are \(\hat q_{p,1},\ldots,\hat q_{p,B}\), calculate their sample standard deviation \(s_q\). The batch-based estimate of the standard error of their average is:
This directly estimates the standard error of the average of batch quantiles. Under the large-sample approximation, each batch quantile has variance about \(p(1-p)/(m f(q_p)^2)\). Dividing this variance by \(B\) gives \(p(1-p)/(Bm f(q_p)^2)\), the same leading-order variance as the pooled-sample quantile. Thus the formula is a useful approximation to the pooled quantile MCSE when batches are independent and sufficiently large. The average of batch quantiles is not generally identical to the pooled quantile, especially for small batches or nonlinear quantile behavior.
Worked Example: Batch-Based MCSE and Simulation Planning
A hypothetical simulation of a PBPK concentration prediction uses \(n=12{,}000\) draws arranged as \(B=12\) independent batches of \(m=1{,}000\) draws. The batch median estimates, in mg/L, are 7.82, 7.86, 7.89, 7.92, 7.95, 8.00, 8.05, 8.08, 8.11, 8.14, 8.18, and 8.00. Their average is \(\bar q_p=8.000\) mg/L. The deviations from that average have squared sum \(0.1460\) (mg/L)\(^2\), so \(s_q=\sqrt{0.1460/(12-1)}=\sqrt{0.01327}=0.1152\) mg/L. The batch MCSE is \(0.1152/\sqrt{12}=0.03326\) mg/L.
Suppose the prespecified precision goal is an MCSE no greater than 0.030 mg/L. If the estimated MCSE scales approximately as \(n^{-1/2}\), the required total simulation size is estimated by \(12{,}000(0.03326/0.030)^2=14{,}750\) draws, approximately. This is a planning approximation, not a guarantee: the density and quantile behavior could change as additional draws are generated. The batch values also show why reporting only the pooled point estimate would omit useful information about simulation precision.
Diagnostics, Alternatives, and Limitations
Order-statistic and batch methods address the same target but expose different weaknesses. The spacing method uses all outcomes in one sample and can be informative when a reasonable local density estimate is available. Its weakness is sensitivity to the spacing window. Batch estimates avoid explicit density estimation and provide a direct picture of between-batch variation, but require enough independent batches and enough draws within each batch to estimate the quantile meaningfully. Agreement between methods is reassuring, but neither method can compensate for a misspecified PBPK model or an unrepresentative input distribution.
Check the following before relying on an MCSE:
- Local spacing stability. Recalculate the spacing estimate using several reasonable values of \(r\). Large changes suggest that the density estimate is unstable or the distribution changes rapidly near the quantile.
- Batch stability. Inspect the batch quantiles for outliers, trends with simulation order, or much greater spread than expected. Such patterns can indicate dependence, nonstationarity, or an implementation problem.
- Effective information near the target. For a quantile with probability \(p\), there are approximately \(np\) outcomes below it and \(n(1-p)\) above it. If either count is small, the estimate may be sensitive to a few observations. This is a warning about quantile precision, not a rare-event probability analysis.
- Target and units. Verify that batches use the same model, input distributions, outcome definition, and quantile convention. Report the MCSE in the same units as the prediction.
A common mistake is to report the width of the simulated prediction distribution as the Monte Carlo error of its median or boundary. These answer different questions: the distribution width describes variation in the predicted outcomes, whereas the MCSE describes how much the estimated quantile would vary across repeated finite simulations. Another mistake is to assume that a very large \(n\) always ensures a precise tail boundary. The MCSE also depends on \(f(q_p)\), which may be small in a sparse tail.
Both methods have limitations. The spacing approximation can fail near a support boundary, at a discontinuity, or in a region with very low density; a spacing-based density estimate can also be biased by curvature. Batch estimates are unreliable if batches are too small, too few, or not independent. In either case, a reported MCSE is an estimated standard deviation, not a confidence interval for the true quantile and not a guarantee that the estimate lies within one MCSE of its target. For Monte Carlo workflows that use dependent or stratified sampling, the simple independent-draw formulas should not be applied without accounting for that design.
Check Your Understanding
Answer each question, then compare your reasoning with the brief solutions.
- For \(n=5{,}000\), estimate the MCSE of the median if the estimated density at the median is \(0.10\) per mg/L.
- What happens to the approximate MCSE if the simulation size is multiplied by four while the local density remains unchanged?
- For a 10th percentile estimated from \(n=8{,}000\) outcomes, how many outcomes are expected below the true quantile?
- Why can an MCSE from a spacing method change substantially when the spacing parameter \(r\) changes?
- A set of small batches gives nearly identical quantile estimates. Why is that not, by itself, proof that the pooled quantile has negligible MCSE?
Solutions. (1) \( \sqrt{0.5(0.5)/5{,}000}/0.10=\sqrt{0.00005}/0.10=0.007071/0.10=0.07071 \) mg/L. (2) Since MCSE is proportional to \(1/\sqrt{n}\), multiplying \(n\) by four halves the approximate MCSE. (3) \(np=8{,}000(0.10)=800\) outcomes. (4) Different \(r\) values trade local detail against stability and may span regions with different density; sensitivity indicates the local density estimate is uncertain. (5) Small batches may produce noisy or uninformative quantiles, and too few batches may conceal between-batch variation. Batch size, number of batches, independence, and quantile stability all need checking.