Why Analyze a Mean Difference?
In a two-arm clinical trial, the treatment and control arms are often summarized by their endpoint means. The mean difference expresses the contrast directly in the endpoint’s original units: for example, a treatment-minus-control difference of \(-2\) points on a symptom scale means the treatment-arm mean is 2 points lower. Bayesian inference gives a posterior distribution for that contrast, allowing uncertainty in both arm means to be carried into the comparison.
This tutorial considers a continuous endpoint with a normal sampling model, known outcome variances, and independent normal priors for the two arm means. “Known variance” means the variance of individual outcomes in each arm is treated as specified, not estimated from the trial data. The posterior variance of a sample mean is therefore based on \(\sigma_j^2/n_j\), where \(j\) identifies the arm.
Model and Assumptions
The assumptions include conditional normality, independence of observations within each arm, and independence of the two arm means under the prior. The last assumption is substantive: it says that the prior information about one arm’s mean does not itself provide information about the other arm’s mean. The two arms may have different sample sizes, known variances, prior means, and prior variances.
Given the model, the sample mean in arm \(j\) has distribution \(\bar{X}_j\mid\mu_j\sim N(\mu_j,\sigma_j^2/n_j)\). Thus, when the variance is known, the observed arm mean contains the information needed for the posterior update; individual observations do not need to be listed separately.
Updating Each Arm and Deriving the Contrast
For one arm, the likelihood of its sample mean is proportional to \(\exp\{-\frac{1}{2}(n_j/\sigma_j^2)(\bar{x}_j-\mu_j)^2\}\). Multiplying by its normal prior adds the prior and likelihood precisions. Completing the square in \(\mu_j\) gives the posterior variance and mean:
Here \(D\) denotes the observed trial data. The quantities \(1/\tau_{j0}^2\) and \(n_j/\sigma_j^2\) are the prior and likelihood precisions. The posterior mean is a precision-weighted average of the prior mean and observed sample mean; the more precise source receives more weight. The posterior variance is smaller than either variance component alone because the independent prior and likelihood contribute information.
Because the prior factorizes across arms and the arm likelihoods are independent, the posterior means \(\mu_T\) and \(\mu_C\) remain independent given the data. A difference of independent normal random variables is normal. Its mean is the difference of the means, while its variance is the sum of the variances. In particular:
One justification for the variance addition is that posterior independence gives \(\operatorname{Var}(\mu_T-\mu_C\mid D)=\operatorname{Var}(\mu_T\mid D)+\operatorname{Var}(\mu_C\mid D)\). Normality can be checked from moment-generating functions: if the arm posterior distributions are \(N(m_T,v_T)\) and \(N(m_C,v_C)\), then the moment-generating function of their difference is
which is the moment-generating function of \(N(m_T-m_C,v_T+v_C)\).
An equal-tailed \(100(1-\alpha)\%\) credible interval is formed from the posterior quantiles. For a 95% interval, the posterior probability between the endpoints is 0.95, with 0.025 in each tail:
The interval is conditional on the model, the observed data, and the specified priors. Its endpoints have the same units as the endpoint means. It is not a statement that a fixed parameter has a 95% probability of lying in the interval under repeated sampling; it is a posterior probability statement about \(\Delta\) under the stated Bayesian model.
Worked Example: A 95% Interval With Diffuse Priors
Suppose a hypothetical trial measures a symptom-burden score, with larger values indicating greater burden. The treatment arm has \(n_T=40\), \(\bar{x}_T=18.4\), and known \(\sigma_T=4\) score points. The control arm has \(n_C=36\), \(\bar{x}_C=20.0\), and known \(\sigma_C=5\) points. Independently, let both arm means have prior \(N(20,100)\), so each prior has mean 20 points and standard deviation 10 points. The normal model, known variances, and independent-prior assumptions are taken as part of this hypothetical example.
For treatment, the posterior precision is \(1/100+40/16=2.51\) per squared point. Thus \(v_T=1/2.51=0.3984\) squared points, and
For control, the posterior precision is \(1/100+36/25=1.45\), so \(v_C=1/1.45=0.6897\) squared points. Its posterior mean is
It follows that \(\Delta\mid D\) has mean \(18.406-20.000=-1.594\) points and variance \(0.3984+0.6897=1.088\) squared points. Its posterior standard deviation is \(\sqrt{1.088}=1.043\) points. The 95% interval is
Conditional on this model and these priors, the posterior probability that the treatment-minus-control mean difference lies between \(-3.638\) and \(0.4509\) points is 0.95. The interval includes zero, so the posterior interval does not place the entire 95% mass on differences in one direction. Negative differences correspond to lower mean symptom burden in the treatment arm.
Prior Influence and Unequal Variances
The update makes the role of prior information explicit. A small prior variance means a concentrated prior and therefore high prior precision. When the data are limited, such a prior can pull the posterior mean noticeably toward the prior mean and reduce posterior uncertainty. With more observations and a fixed known variance, the likelihood precision \(n_j/\sigma_j^2\) increases, so the data generally receive more weight.
The known variances need not be equal. Each arm uses its own likelihood precision, \(n_j/\sigma_j^2\), and the posterior variance of the difference adds the two arm posterior variances. Pooling the arm variances would not follow from this model when they are specified separately.
Worked Example: A Concentrated Prior Changes the Difference
Consider a hypothetical endpoint measured in pain-scale points. In each arm, \(n=10\) and the known individual-outcome variance is \(4\) squared points. The treatment sample mean is 7.0 and the control sample mean is 8.0. Assign independent \(N(8,1)\) priors to both arm means. These assumptions describe a fairly concentrated prior around 8 points.
For either arm, posterior precision is \(1/1+10/4=3.5\), so each posterior variance is \(v=1/3.5=0.2857\) squared points. The treatment posterior mean is
The control sample mean equals its prior mean, so \(m_C=(8+2.5(8))/3.5=8.000\) points. Therefore, \(\Delta\mid D\) has mean \(-0.7143\) points and variance \(0.2857+0.2857=0.5714\) squared points. The standard deviation is \(0.7559\) points, giving the 95% interval
The treatment posterior mean, 7.286 points, lies between its observed mean of 7.0 and prior mean of 8.0. That movement is the expected consequence of combining the data with this informative prior; it is not an arithmetic error.
Worked Example: Different Known Variances by Arm
Suppose a hypothetical continuous endpoint is measured in units. The treatment arm has \(n_T=25\), sample mean 4.2 units, and known variance \(\sigma_T^2=4\) squared units. The control arm has \(n_C=16\), sample mean 5.0 units, and known variance \(\sigma_C^2=9\) squared units. Use independent \(N(5,100)\) priors for both means. Assume the observations satisfy the normal sampling model and the known variances are appropriate.
The treatment posterior precision is \(0.01+25/4=6.26\), giving \(v_T=1/6.26=0.1597\) squared units and
The control precision is \(0.01+16/9=1.7878\), so \(v_C=1/1.7878=0.5594\) squared units. Since its sample mean equals its prior mean, \(m_C=5.000\) units. The posterior mean difference is \(4.201-5.000=-0.7987\) units, with variance \(0.1597+0.5594=0.7191\) squared units and standard deviation \(0.8480\) units. The 95% interval is
The control arm contributes more posterior variance here because its known variance is larger relative to its sample size. The interval includes zero. The negative posterior mean indicates a lower treatment-arm mean, but the interval also assigns posterior mass to positive differences.
Assumptions, Diagnostics, and Alternatives
The formulas are exact for the stated normal model with fixed known variances and independent arm priors. In an applied trial, “known” variances may be design assumptions or externally supplied values; they are not made known merely by inserting sample standard deviations. If variance uncertainty is important, treating an estimated variance as fixed can understate uncertainty. The model with a shared unknown variance requires a different derivation and is not covered by these formulas.
Check that the endpoint is measured consistently across arms, that the summaries correspond to the intended analysis population, and that the known variance assumptions are defensible. Strong skewness, outliers, clustering, repeated measurements, or dependence between observations can invalidate the simple independent normal likelihood. A missing-data process that changes which outcomes are observed can also complicate the interpretation of the sample means. These concerns are not fixed by changing the arithmetic of the posterior update.
A useful diagnostic is prior sensitivity: recompute the posterior using plausible alternative prior means and variances, especially when the sample is small. A large change in the posterior contrast indicates that conclusions depend materially on prior choices. Also check dimensions: posterior means and interval endpoints use outcome units; variances use squared outcome units; and the quantity under the square root for the contrast must be a sum of variances.
| Approach | What it reports | Key distinction |
|---|---|---|
| Independent normal-prior Bayesian analysis here | A posterior distribution and posterior credible interval for \(\Delta\) | Uses specified prior distributions as well as the likelihood |
| Known-variance frequentist two-sample interval | A confidence interval with a repeated-sampling coverage property under its assumptions | Does not use prior distributions; its interpretation differs from a credible interval |
| Direct prior on the contrast | A posterior for \(\Delta\) under a prior specified for the difference | May differ from independent arm priors, particularly if the induced arm means are dependent |
The separate-arm calculation is convenient when prior information is naturally stated for each arm. It is not the only Bayesian parameterization. Independent priors imply a prior variance for the difference equal to the sum of the arm prior variances; a directly specified prior for \(\Delta\) need not have that form. The prior structure should match the scientific information, not just the easiest computation.
Common Mistakes
- Using the individual-outcome variance as the sample-mean variance. The sampling variance of \(\bar{X}_j\) is \(\sigma_j^2/n_j\), not \(\sigma_j^2\).
- Subtracting arm variances. For independent arm means, the variance of the difference is \(v_T+v_C\), not \(v_T-v_C\).
- Assuming both arms have the same precision. Calculate each arm’s update using its own sample size, known variance, and prior.
- Calling a credible interval a probability about a fixed parameter under repeated samples. Its probability statement is conditional on the data and model.
- Ignoring the prior because it is called diffuse. A diffuse proper prior still contributes precision; assess whether that contribution is negligible for the data at hand.
Check Your Understanding
Answer each question, then check the worked solutions below.
- A single arm has prior \(N(10,4)\), \(n=8\), known \(\sigma^2=8\), and sample mean \(\bar{x}=12\). Find its posterior mean and variance.
- Independent arm posteriors are \(\mu_T\mid D\sim N(5,1)\) and \(\mu_C\mid D\sim N(6,1)\). Find the posterior distribution of \(\Delta\) and its 95% equal-tailed interval.
- Why does the posterior variance of the mean difference add the two arm posterior variances?
- What happens to the treatment-arm likelihood precision if its sample size doubles while its known variance stays fixed?
Solutions. (1) The posterior precision is \(1/4+8/8=1.25\), so the variance is \(1/1.25=0.8000\). The mean is \(\{10/4+(8/8)(12)\}/1.25=11.60\). (2) The difference has distribution \(N(5-6,1+1)=N(-1,2)\). Its 95% interval is \(-1\pm1.96\sqrt{2}=[-3.772,1.772]\). (3) Under posterior independence, \(\operatorname{Var}(\mu_T-\mu_C\mid D)=\operatorname{Var}(\mu_T\mid D)+\operatorname{Var}(\mu_C\mid D)\); subtracting a random quantity does not subtract its variance. (4) The likelihood precision changes from \(n_T/\sigma_T^2\) to \(2n_T/\sigma_T^2\), so it doubles.