Why Sample an Individual PK Posterior?
An individual concentration record may constrain PK parameters only imperfectly. A nonlinear concentration model can also make the posterior asymmetric or otherwise poorly represented by a single point estimate and a local approximation. Markov chain Monte Carlo (MCMC) addresses this by generating parameter values whose long-run distribution is the individual posterior. The resulting draws can summarize uncertainty in clearance or support later forecasting; they do not make weakly informative data more informative.
This tutorial develops a Metropolis–Hastings sampler for a simple individual PK model, then shows how to assess its output. The same logic extends to a vector of individual parameters, although dependence among parameters can make sampling substantially more difficult.
Target Posterior and Metropolis–Hastings Sampling
Let \(k=CL/V\) be an elimination rate constant in \(\mathrm{h}^{-1}\). For an illustrative one-compartment IV bolus model with known volume \(V\) and dose \(D\), the predicted concentration at time \(t\) is \(C(t)= (D/V)\exp(-kt)\). For observations \(y_i\) at times \(t_i\), suppose, for this example, that residuals are independent Normal with known standard deviation \(\sigma\). With prior density \(p(k)\), the posterior density is proportional to the likelihood times the prior:
The proportionality omits constants that do not depend on \(k\). MCMC needs the posterior density only up to such a constant. Since \(k\) must be positive, define \(x=\log k\), so every real value of \(x\) maps to a valid \(k\). The target for a chain on \(x\) must be the posterior density with respect to \(x\). If starting from a density with respect to \(k\), this target includes the Jacobian factor \(dk/dx=\exp(x)\). Equivalently, specify a prior directly on \(x\), as in the worked example below.
A common choice is \(x'=x+\epsilon\), where \(\epsilon\sim N(0,s_q^2)\) and \(s_q\) is a proposal scale. The transition rule allows moves to lower-density regions, which is essential: repeatedly moving only uphill would not generate the full posterior. A proposal’s acceptance probability is not itself the probability that the current state is correct; it is part of a rule that produces the desired stationary distribution.
Worked Example: A Forward and Reverse Clearance Proposal
Suppose a hypothetical patient received a dose giving \(D/V=10\ \mathrm{mg/L}\). One concentration, \(y=8\ \mathrm{mg/L}\), was measured at \(t=1\ \mathrm{h}\). Assume the model above, with \(\sigma=1\ \mathrm{mg/L}\), and a prior \(x=\log k\sim N(\log(0.2),1.407^2)\). These assumptions specify the likelihood and prior for this calculation; the example is not a real study.
Ignoring constants common to all \(x\), the log posterior target is \(\ell(x)=-[8-10\exp(-\exp(x))]^2/2-[x-\log(0.2)]^2/(2(1.407)^2)\). At \(k=0.2\ \mathrm{h}^{-1}\), the prediction is \(10e^{-0.2}=8.1873\ \mathrm{mg/L}\), and at \(k=0.1\ \mathrm{h}^{-1}\), it is \(10e^{-0.1}=9.0484\ \mathrm{mg/L}\). Substitution gives log-target kernels of approximately \(-0.01754\) and \(-0.6709\), respectively. Adding the same arbitrary constant, \(-0.9488\), to both gives the equivalent displayed values \(\ell(0.2)=-0.9663\) and \(\ell(0.1)=-1.6197\). A common additive constant cancels from every acceptance ratio.
For the move from \(0.1\) to \(0.2\ \mathrm{h}^{-1}\), the log target difference (proposed minus current) is \(\ell(0.2)-\ell(0.1)=(-0.9663)-(-1.6197)=+0.6534\). With a symmetric random walk on \(x\), the acceptance probability is \(\min(1,e^{0.6534})=1\). For the reverse proposal, from \(0.2\) to \(0.1\ \mathrm{h}^{-1}\), the proposed-minus-current difference is \(\ell(0.1)-\ell(0.2)=-0.6534\), so the acceptance probability is \(e^{-0.6534}\approx0.5203\). These different probabilities are consistent: the lower-target state can still be visited, but not with probability one.
Why the Transition Rule Targets the Posterior
For a symmetric proposal, the acceptance probability is \(\min\{1,\pi(x')/\pi(x)\}\). The probability flow from \(x\) to \(x'\), when weighted by the target density, is proportional to \(\pi(x)q(x'\mid x)\min\{1,\pi(x')/\pi(x)\}=q(x'\mid x)\min\{\pi(x),\pi(x')\}\). By proposal symmetry this equals the flow from \(x'\) to \(x\). Thus the transition satisfies detailed balance with respect to \(\pi\), which makes \(\pi\) stationary. This argument establishes stationarity, not that a finite run has reached it. A chain must also be able to explore the relevant target support; poor proposals, constraints, or separated regions can prevent useful exploration in practice.
For a vector of log-transformed PK parameters, the same acceptance rule applies to the joint posterior density. A proposal may change one parameter at a time or propose a vector move. The latter can be more efficient when parameters are strongly dependent, but selecting an effective proposal can be challenging. This tutorial’s scalar example isolates the sampling logic rather than resolving the broader issue of posterior dependence.
Burn-In, Mixing, and Effective Sample Size
A chain started at an arbitrary point may initially reflect its starting value more than the target posterior. Burn-in is an initial segment that is excluded from summaries to reduce this initialization effect. Choosing a burn-in length does not prove convergence: a chain can appear stable while remaining trapped in a region it has not adequately explored. Multiple chains started at dispersed plausible values help reveal failures that a single trace may conceal.
Mixing describes how rapidly a chain moves through the target distribution. Strong autocorrelation means nearby retained states carry overlapping information. If \(M\) retained draws have lag-\(j\) autocorrelation \(\rho_j\), a common approximation to effective sample size is \(ESS\approx M/[1+2\sum_{j=1}^{\infty}\rho_j]\), using a suitable truncation of the estimated autocorrelation sequence in practice. ESS is an approximate count of independent draws with comparable precision for a particular summary; it is not the number of distinct parameter values and can differ for different summaries.
Worked Example: Estimating Effective Sample Size
Suppose a hypothetical run retains \(M=800\) post-burn-in draws of an individual log-clearance parameter. For a rough illustration, assume the chain’s autocorrelation follows an AR(1)-like pattern with \(\rho_j=0.6^j\). The geometric sum is \(\sum_{j=1}^{\infty}0.6^j=0.6/(1-0.6)=1.5\), so \(ESS\approx800/[1+2(1.5)]=800/4=200\).
If the sample standard deviation of those draws is \(s=0.04\) on the log-clearance scale, the approximate Monte Carlo standard error of their sample mean is \(0.04/\sqrt{200}=0.00283\) log units. This quantifies simulation error in estimating the posterior mean; it is distinct from the posterior uncertainty represented by the spread of the draws. An ESS of 200 is an approximation for this summary under the stated autocorrelation pattern, not a guarantee that every posterior quantity is estimated accurately.
Worked Example: Comparing Chains and Burn-In
Consider two hypothetical chains for the same patient, each run for 1,200 iterations from dispersed starting values. Their traces fluctuate through similar ranges after iteration 150, with no sustained drift or long flat segments. Suppose the analyst excludes the first 200 iterations from each chain, leaving \(M=1{,}000\) draws per chain for summaries. The stated visual behavior supports considering 200 iterations as a reasonable burn-in choice for this run, but does not prove convergence; the chain traces and numerical diagnostics must be considered together.
For a simple illustration of a between-chain check, suppose the post-burn-in chain means are 0.10 and 0.12, and each chain has within-chain variance \(W=0.04\), on a common parameter scale. With \(m=2\) chains and \(n=1{,}000\) draws per chain, the grand mean is 0.11 and the between-chain variance estimate is \(B=n[(0.10-0.11)^2+(0.12-0.11)^2]/(m-1)=0.2\). The pooled variance estimate is \(\widehat{V}=[(n-1)W+B]/n=[999(0.04)+0.2]/1000=0.04016\). The basic potential scale reduction estimate is \(\widehat{R}=\sqrt{\widehat{V}/W}=\sqrt{0.04016/0.04}\approx1.002\).
A value close to 1 indicates that these chains’ within-chain and between-chain variation are similar for this calculation. It does not establish that the posterior has been adequately explored, especially with few chains, weak diagnostics, or a multimodal target. In routine work, use appropriate modern convergence diagnostics as well as visual inspection, and check the parameters and derived quantities that matter for the dosing question.
Diagnostics, Alternatives, and Limitations
A trace plot should show the sampled parameter against iteration. Warning signs include persistent drift, long nearly constant stretches, chains occupying different ranges, or abrupt behavior suggesting numerical or implementation errors. Autocorrelation plots help identify slow mixing; a low acceptance rate can signal proposals that are too large, while an extremely high rate can signal tiny steps and slow exploration. Neither acceptance rate alone is a convergence test. Repeatedly evaluating the likelihood at known parameter values and checking the transformed-scale Jacobian are useful implementation checks.
MCMC is useful when posterior summaries are needed and a nonlinear posterior is not adequately captured by a local approximation. A MAP estimate gives a posterior mode, and a Laplace approximation summarizes the posterior locally around that mode. Those methods can be quicker and useful when the approximation is suitable; MCMC instead represents the target through a sample, at the cost of computation and the need to assess convergence and Monte Carlo error. MCMC does not automatically solve weak identification, prior-data conflict, or model misspecification. Its sample can faithfully represent a posterior that is broad or sensitive to assumptions.
A practical workflow is to define the posterior and its parameter scale, validate the target calculation, run multiple chains, inspect traces and diagnostics, and increase simulation effort when mixing or Monte Carlo precision is inadequate. Only after those checks should retained draws be used to report individual parameter summaries or downstream predictions. For a dosing decision, report the clinically relevant posterior quantity and its units, not just an iteration count or an acceptance rate.
Common Pitfall
- Wrong reasoning: “The chain accepted many proposals and its trace looks roughly stable, so the posterior has converged.”
- Correction: Acceptance and a visually stable trace are limited evidence. Compare multiple dispersed chains, check autocorrelation and relevant convergence diagnostics, and assess effective sample size and Monte Carlo error for the actual summaries being used.
- Wrong reasoning: “Burn-in removes the effect of initialization, so all draws after it are independent.”
- Correction: Burn-in may reduce initialization effects, but retained draws can remain highly autocorrelated. Their effective sample size can be far smaller than their count.
Check Your Understanding
Answer each question, then compare with the solutions below.
- Why must a posterior density be adjusted when a chain is run on \(x=\log k\) but the prior was originally specified as a density with respect to \(k\)?
- For a symmetric proposal, the proposed state has log target 1.2 units below the current state. What is the acceptance probability?
- A chain retains 500 draws and has an approximate integrated autocorrelation time of 5. What is its approximate ESS?
- Name two signs of poor mixing and explain why a high acceptance rate does not rule them out.
- In one sentence, distinguish posterior uncertainty from Monte Carlo error in a posterior mean.
Solutions. 1. The density changes under transformation, so the target with respect to \(x\) includes the Jacobian \(dk/dx=e^x\); omitting it changes the distribution being sampled. 2. The acceptance probability is \(\min(1,e^{-1.2})\approx0.3010\). 3. Since \(ESS\approx M/\text{integrated autocorrelation time}\), \(ESS\approx500/5=100\). 4. Persistent drift and long flat stretches are two warning signs; a high acceptance rate can result from very small proposals that move too little to explore the posterior. 5. Posterior uncertainty is the spread of the target distribution for the parameter, whereas Monte Carlo error is simulation uncertainty in estimating a posterior summary from a finite chain.