Why Posterior Contrasts Matter
In a multi-arm trial, an arm-specific posterior distribution describes uncertainty about that arm's mean or effect. Many decisions and scientific questions, however, concern a difference between arms: for example, whether the mean outcome under treatment A exceeds the mean under treatment B, and by how much. The distribution of that difference must be derived from the joint posterior, not by comparing two separate summaries without accounting for their dependence.
This tutorial develops the normal-normal calculation for continuous outcomes when the outcome variances are known and arm-specific parameters have independent normal priors. It also explains a common multi-arm complication: treatment effects defined against the same control are correlated, even when the underlying arm means have independent posterior distributions.
Model and Posterior for One Arm
Let \(Y_{ai}\) be the outcome for participant \(i\) in arm \(a\), where \(a\) indexes the control and treatment arms. Assume that, conditional on the arm-specific mean \(\theta_a\), outcomes are independent and normally distributed with known variance \(\sigma_a^2\):
The arm means have independent normal priors, \(\theta_a\sim N(m_{a0},v_{a0})\), with \(v_{a0}>0\). The data from different arms are conditionally independent given their arm means. The known-variance assumption is important: the calculation below uses \(\sigma_a^2\), not an estimated sample variance. Write \(\bar{Y}_a\) for the observed mean in arm \(a\). Its sampling distribution given \(\theta_a\) is \(N(\theta_a,\sigma_a^2/n_a)\).
The posterior mean is a precision-weighted combination of the prior mean and the observed arm mean. More precise information receives more weight: the prior precision is \(1/v_{a0}\), while the likelihood precision is \(n_a/\sigma_a^2\). The posterior variance is smaller than either variance source when both are positive and finite. These formulas apply arm by arm under the stated independent-prior and independent-data model.
Deriving the Normal Posterior
For one arm, suppress the index \(a\) and write \(y_i\) for the observed outcomes. Up to terms that do not depend on \(\theta\), the log posterior density is the sum of the log likelihood and the log prior:
The part of the sum of squares involving \(\theta\) is \(n(\theta-\bar{y})^2\), up to a term constant in \(\theta\). Expanding the two relevant squares gives a quadratic coefficient \(1/v_0+n/\sigma^2\) and a linear coefficient \(m_0/v_0+n\bar{y}/\sigma^2\). Completing the square therefore yields a normal density with variance equal to the reciprocal of the quadratic coefficient and mean equal to that variance times the linear coefficient:
Solving these equations gives the posterior formulas above. This derivation also shows why the known variance and normal prior assumptions produce an exactly normal posterior, rather than an approximation.
Pairwise Contrasts of Independent Arm Means
For two distinct arms \(a\) and \(b\), define the pairwise contrast as \(\theta_a-\theta_b\), measured in the same units as the outcome. If their posterior distributions are independent, then a difference of independent normal random variables is normal. Its posterior mean is the difference of the posterior means, and its variance is the sum of the posterior variances:
The posterior standard deviation of the contrast is \(\sqrt{v_a+v_b}\). A central 95% posterior interval is the posterior mean plus or minus \(1.96\) posterior standard deviations. Conditional on the model and observed data, such an interval contains 95% of the posterior probability for the contrast. It is not a frequentist confidence interval, and its interpretation depends on the prior and likelihood assumptions.
More generally, if \(Z_1,\ldots,Z_q\) are jointly normal posterior parameters and \(L=\sum_j c_jZ_j\), then \(L\) is normal with mean \(\sum_j c_j E(Z_j\mid\text{data})\) and variance \(\sum_j\sum_k c_jc_k\operatorname{Cov}(Z_j,Z_k\mid\text{data})\). This covariance form is essential whenever the parameters in a contrast are dependent.
Worked Example: Contrasting Two Independently Modelled Arms
Suppose two hypothetical treatment arms have continuous outcomes measured in points. In each arm the prior for the arm mean is \(N(0,4)\). Arm A has \(n_A=9\), known outcome variance \(\sigma_A^2=9\), and observed mean \(\bar{Y}_A=5.0\). Arm B has \(n_B=4\), known variance \(\sigma_B^2=4\), and observed mean \(\bar{Y}_B=3.5\). Assume independent observations across arms and the independent priors just specified.
For both arms, the sampling variance of the observed mean is \(1\): it is \(9/9=1\) for A and \(4/4=1\) for B. The prior variance is \(4\), so the posterior variance in each arm is
The posterior means are
Thus the posterior contrast A minus B has mean \(4.0-2.8=1.2\) points and variance \(0.8+0.8=1.6\) points squared. Its standard deviation is \(\sqrt{1.6}=1.2649\) points. A central 95% posterior interval is
Under this model and these data, the interval assigns 95% posterior probability to contrasts from about \(-1.279\) to \(3.679\) points. It includes zero, so the posterior distribution retains substantial uncertainty about the direction of the difference.
Shared Controls and Covariance
In a trial with one control and multiple treatments, it is common to define treatment effects as differences from the control mean. Let \(\Delta_j=\theta_j-\theta_0\) be the effect of treatment \(j\) versus control. If the arm means have independent posterior distributions, then the two effects \(\Delta_j\) and \(\Delta_k\) are nevertheless dependent because both contain \(-\theta_0\). Their posterior covariance is \(\operatorname{Var}(\theta_0\mid\text{data})\).
The contrast between the two treatment effects is \(\Delta_j-\Delta_k\). Substituting their definitions shows that the control mean cancels: \(\Delta_j-\Delta_k=\theta_j-\theta_k\). In variance terms, the same cancellation appears through the covariance:
This does not mean that the treatment-versus-control effects are independent. It means their shared control component cancels when comparing the two treatments directly. The earlier material on shared-control posterior covariance gives the covariance structure; the contrast calculation here shows how that structure determines uncertainty for a difference of effects.
Worked Example: Two Treatment Effects With a Shared Control
Consider hypothetical outcomes measured in millimetres. Control, treatment A, and treatment B each have independent \(N(0,4)\) priors on their arm means. Each arm has \(n=4\), known outcome variance \(\sigma^2=4\), and observed means \(10.0\), \(12.0\), and \(11.0\) millimetres, respectively. Conditional independence across arms and known variances are assumed.
For each arm the observed-mean variance is \(4/4=1\). The posterior variance is \((1/4+1)^{-1}=0.8\), and the posterior mean is \(0.8\bar{Y}_a\). Thus the posterior means for control, A, and B are \(8.0\), \(9.6\), and \(8.8\) millimetres.
The posterior means of the treatment effects are \(E(\Delta_A\mid\text{data})=9.6-8.0=1.6\) millimetres and \(E(\Delta_B\mid\text{data})=8.8-8.0=0.8\) millimetres. Each effect has posterior variance \(0.8+0.8=1.6\) millimetres squared, and their covariance is the control posterior variance, \(0.8\) millimetres squared. Consequently, the variance of the A-versus-B contrast is
The contrast mean is \(1.6-0.8=0.8\) millimetres. Equivalently, it is the direct arm-mean difference \(9.6-8.8=0.8\). Its central 95% posterior interval is
If one incorrectly treated the two control-based effects as independent, one would use variance \(1.6+1.6=3.2\), omitting their positive covariance. The correct variance is \(1.6\), because the common control uncertainty cancels in the direct A-versus-B contrast.
Unequal Prior and Data Precision
The same calculation applies when arms have different prior means, prior variances, sample sizes, or known outcome variances. It is important to use each arm's own posterior variance when forming the contrast. Equal weighting of the observed means is not generally justified; the posterior precision formula determines the weight.
Worked Example: Contrasting Arms With Different Precision
Suppose hypothetical outcomes are measured in hours. For arm A, use prior \(N(0,1)\), \(n_A=16\), known variance \(\sigma_A^2=4\), and observed mean \(2.4\) hours. For arm B, use prior \(N(0,4)\), \(n_B=9\), known variance \(\sigma_B^2=9\), and observed mean \(1.1\) hours. The priors and arm data are independent, and both outcome variances are known.
For A, the observed-mean variance is \(4/16=0.25\), so
For B, the observed-mean variance is \(9/9=1\), giving
The A-minus-B contrast therefore has posterior mean \(1.92-0.88=1.04\) hours and variance \(0.2+0.8=1.0\) hours squared. Its standard deviation is \(1.0\) hour, so the central 95% posterior interval is
The prior pulls each observed mean toward zero, but the amount of pull differs because prior and data precision differ by arm. The contrast calculation then propagates both posterior variances.
Assumptions, Diagnostics, and Alternatives
The formulas are exact under the specified model. Their practical usefulness depends on whether the model is a reasonable representation of the trial data and scientific question. Check the following before interpreting a contrast:
- Outcome distribution: conditional normality is most plausible for continuous outcomes without severe skewness or influential outliers. For small samples, strong skewness can make the normal likelihood a poor description.
- Known variance: the within-arm \(\sigma_a^2\) values are treated as known. Substituting estimated sample variances without accounting for their uncertainty does not preserve the exact posterior formula derived here.
- Independence and design: observations must be independent conditional on arm means, and the arm-level data must correspond to the likelihood being used. Clustering, repeated measures, or shared nuisance structure may require a different model.
- Prior specification: the prior means and variances determine shrinkage. Check that prior values use the outcome's units and represent plausible information before seeing the current data.
- Dependence in a contrast: calculate covariances whenever parameters share data or model components. Assuming independence merely because separate arm effects have been reported can give an incorrect contrast variance.
A frequentist alternative estimates an arm difference and uses its sampling standard error, generally without a prior. That approach targets repeated-sampling properties rather than a posterior distribution conditional on prior and data. The normal-normal model is particularly transparent when known variances and defensible normal priors are available; it is not a universal replacement for a model that represents the design more faithfully. When model assumptions are doubtful, diagnostics should motivate an appropriate alternative likelihood or dependence structure rather than an unexamined use of these closed-form expressions.
Check Your Understanding
Work each problem from the stated model. The solutions are included below so that the assumptions and arithmetic can be checked.
- An arm has prior \(N(2,4)\), observed mean \(5\), and sampling variance of the observed mean equal to \(1\). Find its posterior mean and variance.
- Two independent arms have posterior distributions \(N(3,0.5)\) and \(N(1,1.5)\). Give the posterior distribution of the first mean minus the second.
- Two treatment effects versus a shared control each have posterior variance \(2\), and their posterior covariance is \(0.75\). Find the variance of their difference.
- State one model assumption that must be checked before using the exact normal-normal formulas, and explain why it matters.
Solutions. (1) The posterior variance is \((1/4+1)^{-1}=0.8\). The posterior mean is \(0.8(2/4+5)=4.4\). Thus the posterior is \(N(4.4,0.8)\). (2) The contrast mean is \(3-1=2\), and its variance is \(0.5+1.5=2.0\), so the contrast is \(N(2,2)\). (3) The contrast variance is \(2+2-2(0.75)=2.5\). (4) For example, the known-variance assumption matters because the conjugate formulas condition on the sampling variance as fixed; replacing it with an estimate without modelling its uncertainty does not yield the stated exact posterior.