Why Numerical Integration Is Useful
A posterior predictive probability averages future success probabilities over uncertainty about the treatment effect. In a simple normal model, that average can sometimes be calculated exactly. In more complicated success rules, it generally requires numerical integration. Quadrature provides a deterministic way to approximate the integral, and the normal model gives useful exact results for checking whether the implementation is correct.
The method is especially useful when a success rule depends on more than one future statistic, or when the posterior distribution is a mixture. Simulation, covered in the earlier material on Monte Carlo estimation of predictive probability, is flexible but has sampling error. Quadrature avoids that particular source of error, although it can still be inaccurate if the integration grid or tail calculation is poorly chosen.
Model and Integral
Suppose \(\theta\) is the treatment effect, and the interim data \(D\) give a posterior distribution \(\theta\mid D\sim N(m,v)\), where \(m\) is the posterior mean and \(v\) is the posterior variance. Let \(Y\) be a future estimate of the effect. Assume that, conditional on \(\theta\) and the interim data, \(Y\sim N(\theta,\tau^2)\), with \(\tau^2\) known and the future data independent of the interim data given \(\theta\). For a one-sided success rule \(Y>c\), success means that the future estimate exceeds the specified boundary \(c\), in the same units as \(\theta\) and \(Y\).
For the stated model, the conditional probability is \(\Phi((\theta-c)/\tau)\). Thus the predictive probability is an integral over the posterior. Standardizing the posterior with \(Z=(\theta-m)/\sqrt v\), where \(Z\sim N(0,1)\), gives an integral with respect to the standard normal density \(\phi\):
This standardization is convenient because the integration variable and weights do not depend on the posterior mean or variance. For a general success event, replace the conditional probability inside the integral by the probability of that event given \(\theta\) and the interim data. The same posterior averaging principle applies.
Gauss–Hermite Quadrature
An \(r\)-point Gauss–Hermite rule approximates an integral weighted by a Gaussian density using a finite weighted sum. Let \(x_i\) and \(w_i\), for \(i=1,\ldots,r\), be nodes and weights for the convention \(\int_{-\infty}^{\infty}e^{-x^2}f(x)\,dx\approx\sum_{i=1}^r w_i f(x_i)\). Since a standard normal variable has the same distribution as \(\sqrt{2}X\) when \(X\) has density proportional to \(e^{-x^2}\), the predictive probability is approximated by:
The factor \(1/\sqrt{\pi}\) and the \(\sqrt{2v}\) in the function argument are both important. Using nodes or weights defined for a different quadrature convention without changing the formula can produce a plausible-looking but incorrect answer. A practical implementation evaluates the conditional success probability at each transformed node and takes the weighted average.
Worked Example: A Three-Point Quadrature Check
Worked Example: A Three-Point Quadrature Check
Suppose \(\theta\mid D\sim N(0.4,0.09)\), the future estimate has conditional standard error \(\tau=0.5\), and success is \(Y>0.5\). The treatment effect and boundary are measured in the same hypothetical units. Use the three-point standard-normal quadrature rule with nodes \(0,\pm\sqrt{3}\) and weights \(2/3,1/6,1/6\).
Here \(m=0.4\), \(\sqrt v=0.3\), and the conditional probability at a standard-normal node \(z\) is \(\Phi((-0.1+0.3z)/0.5)=\Phi(-0.2+0.6z)\). The three function values are approximately \(\Phi(-0.2)=0.4207\), \(\Phi(0.8392)=0.7993\), and \(\Phi(-1.2392)=0.1076\). Therefore:
This is a useful illustration of the calculation, but the three-point rule is only an approximation. In this particular model we can check it against an exact result: the predictive distribution of \(Y\) is \(N(0.4,0.09+0.25)\). Hence \(P(Y>0.5\mid D)=1-\Phi(0.1/\sqrt{0.34})\approx0.4319\). The quadrature error is about \(0.0003\), which is small here but would need evaluation against the accuracy required for the application.
An Exact Benchmark and Its Justification
For the single normal threshold rule, the integral has a closed form. One way to see this is to write \(Y=\theta+\varepsilon\), where, conditional on \(\theta\) and \(D\), \(\varepsilon\sim N(0,\tau^2)\) and is independent of \(\theta\mid D\). Since \(\theta\mid D\sim N(m,v)\), the sum is normally distributed with mean \(m\) and variance \(v+\tau^2\). Consequently:
This identity is both a result and a diagnostic. For a single linear threshold under the stated normal assumptions, use the closed form rather than quadrature if only the probability is needed. Quadrature remains valuable as a general computational approach for more complex success events, and this simpler case lets you test code, node conventions, and posterior parameterization before applying them to a harder integral.
Worked Example: An Extreme Lower-Tail Probability
Worked Example: An Extreme Lower-Tail Probability
For a hypothetical trial, suppose \(\theta\mid D\sim N(19.6,25)\), a future estimate satisfies \(Y\mid\theta,D\sim N(\theta,50)\), and success is defined as \(Y\leq -5\). All values use the same hypothetical effect units. This is a lower-tail rule, so the integrand is \(\Phi((-5-\theta)/\sqrt{50})\).
The posterior predictive distribution is \(Y\mid D\sim N(19.6,75)\). The exact probability, which also provides a stringent check on numerical integration, is:
Thus the predictive probability of meeting this lower-tail rule is about \(0.2252\%\). A quadrature implementation should reproduce approximately \(0.002252\) to the displayed precision when it evaluates the posterior integral correctly. In particular, the ratio rounds to \(-2.841\), not \(-2.840\).
This example also shows why substituting only the posterior mean for \(\theta\) is not the same calculation. Doing so would give \(\Phi((-5-19.6)/\sqrt{50})\approx0.0002517\), because it omits the posterior variance of \(25\). That plug-in probability is not the posterior predictive probability.
Mixture Posteriors and Componentwise Integration
If the posterior is a mixture, integrate over each component and then average the component-specific probabilities using their posterior weights. Suppose \(\theta\mid D\) has components \(N(m_j,v_j)\) with weights \(\pi_j\), where \(\pi_j\geq0\) and \(\sum_j\pi_j=1\). For the normal future estimate and threshold above, each component has its own normal predictive distribution. The mixture predictive probability is:
Worked Example: A Two-Component Posterior
Consider a hypothetical posterior with weight \(0.7\) on \(N(0,1)\) and weight \(0.3\) on \(N(2,0.25)\). Let \(\tau^2=4\) and let success mean \(Y>1\). The effect and boundary are in the same units. The component-specific predictive probabilities are:
Weighting these probabilities gives \(0.7(0.3274)+0.3(0.6862)=0.4350\), to four decimal places. In a more complicated component model, the component-specific integrals can each be evaluated by quadrature before applying the same mixture weighting. Averaging component probabilities is essential: averaging the component means and variances first generally does not preserve the mixture distribution or its tail probabilities.
Accuracy Checks and Failure Modes
A quadrature answer is an approximation, not a guarantee of accuracy. Check the calculation in ways that target different potential errors:
- Check parameterization. Confirm that \(v\) is the posterior variance and \(\tau^2\) is the conditional future variance. The normal integral uses \(\sqrt v\) to transform the posterior and \(\tau\) in the conditional probability.
- Check weights and nodes. For a normalized standard-normal quadrature rule, the weights used directly with \(\phi\) must sum to one. For the physicists’ Gauss–Hermite convention used above, the weights are instead divided by \(\sqrt{\pi}\).
- Increase the order. Compare results using progressively more quadrature points. Stability across orders is reassuring, although it does not by itself prove accuracy if the integrand is poorly resolved.
- Use an exact special case. In the single-threshold normal model, compare with the closed form derived above. A discrepancy can reveal a coding error, an incorrect tail direction, or an inconsistent variance.
- Inspect the tails. For probabilities very near zero or one, tiny absolute errors can be large relative errors. Direct computation of a small probability as \(1-\Phi(a)\) for large positive \(a\) can lose precision through subtraction. Use a numerically stable survival-function or log-CDF calculation where available.
Fixed-node quadrature can perform poorly when the region contributing most of the probability is narrow or far into a tail and the chosen nodes do not resolve it. An adaptive integrator can allocate effort to that region, but it too needs appropriate tolerances and stable evaluation of the integrand. Truncating a standard-normal integral to \([-K,K]\) also omits posterior mass \(P(|Z|>K)\); a small omitted mass is not automatically negligible relative to an extremely small predictive probability. For such cases, check convergence with different transformations or integration strategies and report the numerical tolerance or stability checks used.
Quadrature, Simulation, and the Closed Form
| Approach | Strength | Main caution |
|---|---|---|
| Closed form | Exact under the single normal-threshold model; fast and easy to check | Usually unavailable for complicated success regions or posterior structures |
| Quadrature | Deterministic weighted approximation; efficient for low-dimensional integrals | Accuracy depends on nodes, order, transformations, and tail handling |
| Monte Carlo simulation | Flexible for complex models and high-dimensional uncertainty | Has simulation error; rare successes may require many draws |
The methods are complementary. Use the closed form when its assumptions and event definition apply. For a low-dimensional integral, quadrature often gives a precise answer with no Monte Carlo sampling variability. Simulation is often easier to extend to complex or high-dimensional predictive models, but its uncertainty should be quantified, especially for rare events. Whenever possible, compare quadrature and simulation in a tractable case before relying on either for a more complicated calculation.
Common Mistake
A frequent error is to treat the posterior mean as if it were the true treatment effect, calculate a conditional success probability at that one value, and label the result predictive. That calculation ignores posterior uncertainty. The predictive probability instead averages conditional probabilities over the full posterior distribution; in the normal threshold example, this adds \(v\) to the future variance. A second error is to assume that a quadrature result is accurate simply because it is a deterministic number. Determinism removes simulation noise, not numerical integration error. Check the result against an exact benchmark where available and assess convergence, particularly in extreme tails.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- In the normal model, what distribution does \(Y\mid D\) have if \(\theta\mid D\sim N(m,v)\) and \(Y\mid\theta,D\sim N(\theta,\tau^2)\)?
- Why must the standard-normal Gauss–Hermite formula include both a \(\sqrt{2}\) in the transformed node and a \(1/\sqrt{\pi}\) factor?
- A lower-tail success rule is \(Y\leq c\). What conditional probability belongs inside the posterior integral?
- Why can a very small omitted posterior tail mass still matter when estimating an extreme predictive probability?
Solutions. (1) The marginal distribution is \(Y\mid D\sim N(m,v+\tau^2)\), because \(Y\) is the sum of the normally distributed posterior effect and independent future sampling error. (2) The standard-normal integral is obtained from the Gauss–Hermite convention weighted by \(e^{-x^2}\): setting \(z=\sqrt{2}x\) creates the \(\sqrt{2}\) node transformation, and normalizing the transformed density creates \(1/\sqrt{\pi}\). (3) The integrand is \(P(Y\leq c\mid\theta,D)=\Phi((c-\theta)/\tau)\). (4) The omitted mass may be small in absolute terms but comparable to, or larger than, the target probability, causing substantial relative error.