Tutorials › Nonlinear Mixed-Effects Models (NLME) › Posterior Summaries and Credible Intervals

Bayesian NLME with MCMC · Tutorial 256 of 797

Posterior Summaries and Credible Intervals

Use posterior draws to summarize typical NLME parameters and derived quantities, and interpret credible intervals correctly.

Advanced 11 min read

What You'll Learn

  • Calculate posterior means and medians from retained MCMC draws.
  • Construct equal-tailed credible intervals using empirical posterior quantiles.
  • Summarize derived quantities by transforming each joint posterior draw.
  • Distinguish posterior credible intervals from frequentist confidence intervals.
  • Recognize how skew, chain dependence, and finite Monte Carlo precision affect summaries.
  • Compare equal-tailed intervals with highest-posterior-density intervals.

From Posterior Draws to Useful Summaries

After fitting a Bayesian nonlinear mixed-effects model, MCMC produces draws from the posterior distribution of its parameters. A fitted model may yield thousands of draws for population clearance, a random-effect standard deviation, residual error, or a quantity calculated from several parameters. Reporting every draw is not useful, but a single number can hide important features such as skewness or tail uncertainty. Posterior summaries provide a compact description while retaining a clear connection to the uncertainty represented by the fitted model.

The summaries in this tutorial describe the posterior conditional on the observed data, the model, and its prior. Their reliability as numerical approximations also depends on having draws that adequately represent that posterior. The earlier material on autocorrelation and mixing in MCMC chains, effective sample size, and Monte Carlo standard errors is relevant here: a long stored chain does not necessarily provide equally many independent pieces of information.

Definition: Let \(\theta\) be a model parameter and let \(\theta^{(1)},\ldots,\theta^{(M)}\) be retained MCMC draws after warmup. The posterior mean is \(E(\theta\mid y)\), estimated by \(M^{-1}\sum_{s=1}^{M}\theta^{(s)}\). The posterior median is the 50th percentile of the posterior distribution, estimated by the sample median of those draws. A \(100(1-\alpha)\%\) equal-tailed credible interval has lower and upper posterior quantiles \(\alpha/2\) and \(1-\alpha/2\), respectively.

Here \(y\) denotes the observed data. The posterior mean summarizes the center using squared-distance loss, while the median is a central quantile and is less affected by a long tail. Neither is universally preferable: the choice should reflect the posterior shape and the quantity being reported. A posterior summary is not itself a diagnostic of model fit or sampler convergence.

Calculating Summaries From a Finite Chain

For a retained chain of \(M\) draws, the estimated posterior mean is the arithmetic average of the draws. To calculate a median, sort the draws and take the middle value, or average the two middle values when \(M\) is even. Empirical quantiles can be calculated using different conventions. In the worked calculations below, the sorted values are \(x_{(1)}\leq\cdots\leq x_{(M)}\), and the quantile at probability \(p\) uses the linearly interpolated rank \(r=1+(M-1)p\). If \(r=j+a\), where \(j\) is an integer and \(0\leq a<1\), the quantile is \(x_{(j)}+a\{x_{(j+1)}-x_{(j)}\}\). Statistical software may use a different quantile convention, especially for small samples, so a report should state the interval method and use consistent software settings.

Worked Example: Mean, Median, and a 95% Interval for Clearance

Suppose ten retained draws for population clearance, in L/h, from a hypothetical NLME analysis are \(4.2, 4.5, 4.6, 4.8, 4.9, 5.0, 5.1, 5.3, 5.8,\) and \(7.8\). These are illustrative draws, not observations from a real study. They are already sorted.

Posterior mean estimate. The sum is \(52.0\) L/h, so the draw average is \(52.0/10=5.20\) L/h.

Posterior median estimate. With ten draws, average the fifth and sixth values: \((4.9+5.0)/2=4.95\) L/h.

95% equal-tailed interval estimate. The lower-tail probability is \(0.025\), so \(r=1+9(0.025)=1.225\). Interpolate between the first and second draws: \(4.2+0.225(4.5-4.2)=4.2675\) L/h. For the upper endpoint, \(r=1+9(0.975)=9.775\), giving \(5.8+0.775(7.8-5.8)=7.35\) L/h. The resulting estimated interval is approximately \(4.27\) to \(7.35\) L/h. The high draw pulls the mean above the median and stretches the upper tail.

Ten draws make the arithmetic transparent, but are far too few to represent a practical posterior summary reliably. In an actual analysis, use the retained chains that have passed appropriate sampling diagnostics and assess the Monte Carlo precision of the reported endpoints and center.

The calculation is a Monte Carlo approximation: posterior expectations are approximated by averages over draws, and posterior probabilities or quantiles by proportions or quantiles of draws. If draws are dependent, the formulas still describe the empirical chain, but dependence affects how precisely that chain represents the target posterior. Increasing the raw draw count alone may not solve poor exploration or strong autocorrelation.

Credible Intervals and Their Interpretation

Definition: A \(100(1-\alpha)\%\) posterior credible interval \(C(y)\) for \(\theta\) is an interval satisfying \(P\{\theta\in C(y)\mid y\}=1-\alpha\), under the specified model and prior. An equal-tailed interval allocates posterior probability \(\alpha/2\) below its lower endpoint and \(\alpha/2\) above its upper endpoint.

Thus, conditional on the model, prior, and observed data, a 95% credible interval assigns 95% posterior probability to values of the parameter inside that interval. This probability statement concerns the parameter's posterior distribution after observing the data. A frequentist 95% confidence interval has a different interpretation: under repeated sampling and the procedure's assumptions, intervals constructed in that way cover the fixed parameter in 95% of repetitions. It is not correct to interpret a confidence interval as assigning a 95% probability to the fixed parameter after the particular data have been observed.

Equal-tailed intervals are straightforward to compute from posterior quantiles and are invariant under monotone transformations when endpoints are transformed in the corresponding order. A highest-posterior-density (HPD) interval is instead a region containing the specified posterior probability whose included values have higher density than excluded values. For a unimodal posterior it is often described as the shortest interval at that probability level, subject to the density-based definition. The two intervals can differ for a skewed posterior. HPD intervals can also be awkward for multimodal distributions, where a high-density credible set may consist of more than one interval. State which interval is reported rather than using “credible interval” to imply a particular construction.

Summarizing Derived Quantities

Many pharmacometric quantities are functions of more than one model parameter. If \(\phi=g(\theta_1,\ldots,\theta_k)\), calculate \(\phi^{(s)}=g(\theta_1^{(s)},\ldots,\theta_k^{(s)})\) for every joint posterior draw \(s\). Then summarize the resulting \(M\) values. Pairing the parameters by draw preserves their posterior dependence; computing a function from separately summarized parameters generally does not.

Worked Example: A Derived Steady-State Concentration

For a hypothetical constant-input example, suppose the input rate is \(100\) mg/h and six joint posterior draws for clearance are \(4.0, 4.5, 5.0, 5.5, 6.0,\) and \(8.0\) L/h. Under the steady-state relationship \(C_{\mathrm{avg}}=\text{input rate}/CL\), the derived average concentration has units of mg/L.

Calculate the derived value for each draw: \(100/4.0=25.0\), \(100/4.5=22.22\), \(100/5.0=20.0\), \(100/5.5=18.18\), \(100/6.0=16.67\), and \(100/8.0=12.50\) mg/L. In sorted order these are \(12.50,16.67,18.18,20.0,22.22,25.0\) mg/L.

The derived posterior mean estimate is \((12.50+16.67+18.18+20.0+22.22+25.0)/6=19.10\) mg/L, to two decimal places. The median is \((18.18+20.0)/2=19.09\) mg/L. For a 90% equal-tailed interval, the endpoint probabilities are \(0.05\) and \(0.95\). Their ranks are \(1+5(0.05)=1.25\) and \(1+5(0.95)=5.75\). The lower endpoint is \(12.50+0.25(16.67-12.50)=13.54\) mg/L; the upper is \(22.22+0.75(25.0-22.22)=24.31\) mg/L.

These calculations summarize the draws of the derived quantity. In general, the mean of \(100/CL\) is not \(100\) divided by the mean of \(CL\), because taking a reciprocal is nonlinear. Likewise, using a separate marginal draw for clearance at each step would discard any dependence between clearance and other parameters needed for a more complex derived quantity.

Skewness, Monte Carlo Precision, and Reporting

Worked Example: A Skewed Posterior Can Separate the Mean and Median

Consider ten illustrative posterior draws for a positive parameter, in mg/L: \(1.0, 1.0, 1.1, 1.2, 1.3, 1.5, 1.8, 2.2, 3.5,\) and \(8.0\). The mean is \(22.6/10=2.26\) mg/L. The median is \((1.3+1.5)/2=1.40\) mg/L.

For an 80% equal-tailed interval, the endpoint probabilities are \(0.10\) and \(0.90\). The corresponding ranks are \(1+9(0.10)=1.9\) and \(1+9(0.90)=9.1\). The lower quantile is \(1.0+0.9(1.0-1.0)=1.0\) mg/L; the upper is \(3.5+0.1(8.0-3.5)=3.95\) mg/L. The unusually high draw contributes substantially to the mean and upper tail, while the median remains near the middle of the draws. In a real analysis, this difference could reflect posterior skewness, but a small number of draws cannot establish that the posterior has been sampled adequately.

A reported posterior summary should identify the parameter or derived quantity, its units, the center (mean or median), the interval level, and the interval construction. For MCMC estimates, also evaluate convergence and Monte Carlo precision. Rank-normalized \(\hat{R}\), effective sample size, and Monte Carlo standard errors help assess whether chains have mixed and whether the reported quantities are numerically stable. Quantile endpoints can have appreciable Monte Carlo error even when the posterior mean looks stable, particularly in the tails. A narrow interval from a poorly exploring chain is not evidence of precise posterior knowledge.

Several common mistakes are avoidable. First, do not say there is a 95% chance that a frequentist confidence interval contains the fixed parameter; that is not its repeated-sampling interpretation. For a Bayesian credible interval, the posterior probability statement is appropriate, but it remains conditional on the chosen model and prior. Second, do not calculate an interval for a nonlinear derived quantity by transforming only the interval endpoints for its inputs unless the transformation and ordering justify that operation. Transforming every joint draw is the general approach. Third, do not treat the posterior mean and median as interchangeable when the posterior is skewed, or report excessive decimal places that the Monte Carlo precision does not support.

The main alternatives answer different summary needs. The mean uses all draw magnitudes and can be sensitive to tails; the median describes the central posterior quantile and is more robust to extreme values. Equal-tailed intervals summarize specified posterior quantiles, whereas HPD intervals emphasize regions of high posterior density. A frequentist confidence interval uses a repeated-sampling framework rather than a posterior probability statement. None of these summaries repairs a misspecified model, an unrepresentative prior, or inadequate MCMC exploration.

Key takeaway: Compute summaries from retained posterior draws, and compute a derived quantity within each joint draw before summarizing it. Interpret a credible interval as posterior probability conditional on the model, prior, and data; report its construction and assess its Monte Carlo precision.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. Five sorted posterior draws for a parameter in mg/L are \(2, 3, 4, 5, 11\). What are the draw mean and median?
  2. What does a 90% Bayesian credible interval mean, and how does that differ from a 90% frequentist confidence interval?
  3. If \(\phi=1/CL\), how should posterior draws for \(\phi\) be obtained?
  4. Can the mean of a derived quantity generally be found by applying its formula to the posterior means of its inputs? Explain.
  5. Why can a chain with many stored draws still give an unreliable interval?

Solutions. (1) The mean is \((2+3+4+5+11)/5=5\) mg/L; the median is the middle draw, \(4\) mg/L. (2) Conditional on the model, prior, and observed data, the posterior probability that the parameter lies in the 90% credible interval is 90%. A frequentist 90% confidence procedure covers the fixed parameter in 90% of repeated samples under its assumptions. (3) For every retained draw, calculate \(\phi^{(s)}=1/CL^{(s)}\), retaining the matching draw, and summarize those transformed values. (4) No. For a nonlinear function, the function of posterior means generally differs from the mean of the function; transform each draw first. (5) Autocorrelation, poor mixing, or failure to explore parts of the posterior can make the effective information far smaller than the stored draw count, so convergence and Monte Carlo precision must be assessed.