Tutorials › Bayesian Clinical Trials › Posterior Inference for Paired Continuous Outcomes

Posterior Inference for Trial Endpoints · Tutorial 17 of 696

Posterior Inference for Paired Continuous Outcomes

You will derive and apply a Bayesian model for the mean within-patient difference, then interpret its credible interval in clinical units.

Beginner 12 min read

What You'll Learn

  • Define the within-patient difference and state the assumptions for a paired normal model.
  • Derive the conjugate posterior parameters for the mean difference and variance.
  • Obtain and interpret a Student t credible interval for the mean difference.
  • Work through analyses using hypothetical paired trial measurements.
  • Recognize when pairing, normality, or missing-data assumptions may be problematic.
  • Compare paired analysis with an unpaired analysis and a known-variance model.

Why Analyze the Within-Patient Difference?

In a paired trial, each patient contributes two related continuous measurements: for example, an outcome before and after treatment, or measurements under two conditions. The central quantity is the change within each patient, not the difference between two unrelated group averages. Pairing preserves the information about how the two measurements move together and can make the treatment contrast more precise.

Choose a direction and keep it fixed. For a two-condition trial, define \(d_i=Y_{i,T}-Y_{i,C}\), where \(Y_{i,T}\) and \(Y_{i,C}\) are the measurements for patient \(i\) under treatment and control. For a before-and-after study, one might instead define follow-up minus baseline. The sign then has a context-specific interpretation: if lower values are better, a negative treatment-minus-control difference favors treatment; if higher values are better, the interpretation reverses.

Definition: The paired difference for patient \(i\) is the within-patient contrast \(d_i\), defined in a stated direction. The population mean paired difference is \(\mu_d\). Inference about \(\mu_d\) uses the observed differences \(d_1,\ldots,d_n\), with each patient contributing one difference.

The analysis below assumes that the observed differences are independent across patients and arise from a normal distribution with a common mean and variance: \(d_i\mid\mu_d,\sigma_d^2\sim N(\mu_d,\sigma_d^2)\). This model concerns the distribution of the differences; it does not require the two measurements within a patient to be independent. Indeed, their association is one reason to form differences. The model is appropriate when the paired contrast is the target, the patient pairs are sampled or assigned in a way that supports the intended inference, and the difference distribution is reasonably represented by a normal model. It also assumes the recorded pairs are analyzed consistently; missing or selectively observed measurements require additional justification.

Normal-Inverse-Gamma Model and Posterior

Use a normal prior for the mean difference conditional on its variance and an inverse-gamma prior for that variance:

$$ \mu_d\mid\sigma_d^2\sim N\!\left(m_0,\frac{\sigma_d^2}{\kappa_0}\right), \qquad \sigma_d^2\sim\operatorname{Inv\text{-}Gamma}(a_0,b_0). $$

Here \(\kappa_0>0\), \(a_0>0\), and \(b_0>0\). The inverse-gamma convention used here has density proportional to \((\sigma_d^2)^{-(a_0+1)}\exp(-b_0/\sigma_d^2)\). The prior mean for \(\mu_d\), conditional on the variance, is \(m_0\); \(\kappa_0\) controls its concentration. The parameters \(a_0,b_0\) control prior information about the variance. These choices are assumptions, not consequences of the trial data, and should be considered in relation to the outcome scale.

Let \(\bar d=\frac{1}{n}\sum_{i=1}^n d_i\), and let \(S_d=\sum_{i=1}^n(d_i-\bar d)^2\). The posterior parameters are

$$ \kappa_n=\kappa_0+n,\qquad m_n=\frac{\kappa_0m_0+n\bar d}{\kappa_n},\qquad a_n=a_0+\frac{n}{2}, $$
$$ b_n=b_0+\frac12\left[S_d+\frac{\kappa_0n}{\kappa_n}(\bar d-m_0)^2\right]. $$

Thus \(\sigma_d^2\mid d_1,\ldots,d_n\sim\operatorname{Inv\text{-}Gamma}(a_n,b_n)\), and \(\mu_d\mid\sigma_d^2,d_1,\ldots,d_n\sim N(m_n,\sigma_d^2/\kappa_n)\). Integrating out the unknown variance gives a Student t posterior for the mean difference:

$$ \mu_d\mid d_1,\ldots,d_n \sim t_{2a_n}\left(m_n,\sqrt{\frac{b_n}{a_n\kappa_n}}\right). $$

The second argument is the Student t scale, not its standard deviation. The degrees of freedom are \(2a_n\). A central \(100(1-\alpha)\%\) credible interval is

$$ m_n\ \pm\ t_{2a_n,\,1-\alpha/2}\sqrt{\frac{b_n}{a_n\kappa_n}}, $$

where \(t_{\nu,q}\) is the \(q\)-quantile of a Student t distribution with \(\nu\) degrees of freedom. Given the model and prior, the posterior probability that \(\mu_d\) lies in this interval is \(1-\alpha\). This is a probability statement about the parameter under the posterior, not a claim that repeated intervals contain a fixed parameter with a particular long-run frequency.

Why the Posterior Has This Form

The likelihood for the differences is proportional to \((\sigma_d^2)^{-n/2}\exp[-\sum_i(d_i-\mu_d)^2/(2\sigma_d^2)]\). The identity

$$ \sum_{i=1}^n(d_i-\mu_d)^2 =S_d+n(\bar d-\mu_d)^2 $$

separates variation around the observed mean from variation between the observed mean and the parameter. Multiplying likelihood and prior adds the quadratic terms in \(\mu_d\). Completing the square gives

$$ n(\bar d-\mu_d)^2+\kappa_0(\mu_d-m_0)^2 =\kappa_n(\mu_d-m_n)^2+ \frac{\kappa_0n}{\kappa_n}(\bar d-m_0)^2. $$

The first term determines the conditional normal posterior for \(\mu_d\). The remaining term adds to the inverse-gamma scale, along with \(S_d\), yielding \(b_n\); the likelihood contributes \(n/2\) to the shape, yielding \(a_n\). Finally, integrating the normal conditional distribution over the inverse-gamma variance produces the stated Student t distribution. This derivation also explains why the interval accounts for uncertainty in both the mean and the unknown variance.

Worked Example: Treatment Minus Control on a Lower-Is-Better Outcome

Suppose a hypothetical paired trial records a lower-is-better symptom score for six patients under treatment and control. The differences, defined as treatment minus control and measured in points, are \(-4,-3,-2,-2,-1,0\). Use \(m_0=0\), \(\kappa_0=1\), \(a_0=2\), and \(b_0=3\), and calculate a 95% credible interval.

The six differences sum to \(-12\), so \(\bar d=-12/6=-2\) points. Their squared deviations from \(-2\) sum to \(4+1+0+0+1+4=10\) points squared, hence \(S_d=10\). The posterior parameters are

$$ \kappa_n=1+6=7,\qquad m_n=\frac{1(0)+6(-2)}{7}=-\frac{12}{7}=-1.7143, \qquad a_n=2+\frac{6}{2}=5. $$

For the scale parameter,

$$ b_n=3+\frac12\left[10+\frac{1(6)}{7}(-2-0)^2\right] =3+\frac12\left(10+\frac{24}{7}\right) =\frac{68}{7}=9.7143. $$

The posterior for \(\mu_d\) has 10 degrees of freedom and scale \(\sqrt{9.7143/(5\cdot7)}=0.5268\) points. Using \(t_{10,0.975}=2.228\), the interval is

$$ -1.7143\pm2.228(0.5268)=(-2.888,\,-0.541)\text{ points}. $$

Under this model and prior, the posterior probability that the population mean treatment-minus-control difference lies between \(-2.888\) and \(-0.541\) points is 95%. Because lower scores are better and the interval is below zero, the posterior supports a lower mean score under treatment than control. The interval quantifies uncertainty about the mean difference; it does not imply that every patient benefits by an amount in that range.

Worked Analyses and Interpretation

Worked Example: A Change With a Positive Direction

In a hypothetical study with five patients, define the difference as follow-up minus baseline for a measure where higher values indicate improvement. The observed differences are \(1,2,2,3,2\) units. Use \(m_0=0\), \(\kappa_0=1\), \(a_0=2\), and \(b_0=1\).

The sum is 10, so \(\bar d=2\) units. The deviations from 2 are \(-1,0,0,1,0\), and \(S_d=2\) units squared. Therefore,

$$ \kappa_n=6,\quad m_n=\frac{1(0)+5(2)}{6}=1.6667,\quad a_n=2+\frac52=4.5, $$
$$ b_n=1+\frac12\left[2+\frac{5}{6}(2-0)^2\right] =1+\frac12\left(\frac{16}{3}\right)=3.6667. $$

The posterior scale is \(\sqrt{3.6667/(4.5\cdot6)}=0.3685\) units, with 9 degrees of freedom. Since \(t_{9,0.975}=2.262\), the 95% credible interval is \(1.6667\pm2.262(0.3685)=(0.833,2.500)\) units. Under the model and prior, the mean change is credibly positive, consistent with improvement as defined here.

Worked Example: A Small Paired Sample With Substantial Uncertainty

Consider a hypothetical four-patient trial with treatment-minus-control differences of \(-2,-1,0,1\) points on a lower-is-better outcome. Let \(m_0=0\), \(\kappa_0=2\), \(a_0=2\), and \(b_0=2\). The observed mean is \(\bar d=-0.5\) points, and the squared deviations sum to \(S_d=5\) points squared.

The updates are \(\kappa_n=2+4=6\), \(m_n=[2(0)+4(-0.5)]/6=-1/3=-0.3333\) points, and \(a_n=2+4/2=4\). The scale parameter is

$$ b_n=2+\frac12\left[5+\frac{2(4)}{6}(-0.5-0)^2\right] =2+\frac12\left(5+\frac13\right)=\frac{14}{3}=4.6667. $$

The posterior scale is \(\sqrt{(14/3)/(4\cdot6)}=\sqrt{7}/6=0.4410\) points, with 8 degrees of freedom. Using \(t_{8,0.975}=2.306\), the interval is \(-0.3333\pm2.306(0.4410)=(-1.350,0.684)\) points. It includes zero, so the data and specified prior leave meaningful uncertainty about the direction of the population mean difference. This does not establish that there is no effect; it shows that this small sample does not pin down the mean difference precisely enough for this interval to exclude zero.

Assumptions, Diagnostics, and Alternatives

The paired model is useful because it analyzes the relevant within-patient contrast directly. In a random-effects or repeated-measures description, the variance of a difference reflects the variability of both measurements and their covariance: \(\operatorname{Var}(Y_T-Y_C)=\operatorname{Var}(Y_T)+\operatorname{Var}(Y_C)-2\operatorname{Cov}(Y_T,Y_C)\). Forming patient-level differences automatically retains this covariance information. Treating the two measurements as independent groups discards it and answers a different variance calculation.

Before relying on the posterior, examine the differences themselves. A plot of the differences can reveal marked skewness, outliers, clusters, or a spread that changes across clinically relevant subgroups. With a small sample, such checks have limited power: a roughly symmetric plot does not prove normality. Confirm that each difference uses the intended measurements, that units and direction are consistent, and that one patient has not contributed multiple dependent pairs as if they were independent. A few extreme differences can strongly affect both \(\bar d\) and \(S_d\), and thus the posterior location and scale. Investigate data errors and clinical explanations; do not remove observations solely because they weaken a desired conclusion.

Pairwise analysis also has a data limitation: a patient without both measurements does not have an observed difference. Excluding such patients is not automatically harmless. If pair availability depends on outcomes or prognosis, the complete-pair analysis may be biased for the intended trial population. The simple model does not solve informative missingness; the missing-data mechanism and the estimand must be considered separately.

ApproachWhat it modelsWhen it is appropriateKey distinction
Paired normal model hereThe patient-level differences and their meanComplete pairs with a reasonably normal difference distributionUses the within-patient association through the differences
Unpaired two-group modelSeparate outcome distributions in unrelated groupsDifferent patients are observed in the two groupsDoes not use the within-patient pairing and is not a substitute for matched data
Known-variance normal modelThe mean difference with variance treated as knownA known variance is genuinely available and appropriateDoes not estimate variance uncertainty from the paired sample

A common mistake is to analyze the treatment and control measurements as independent observations even though they come from the same patients. That reasoning ignores the pairing and can misstate uncertainty. The correction is to compute one consistently directed difference per patient and model those differences. Another mistake is to interpret a 95% credible interval as giving a 95% posterior probability that each patient's effect lies inside it. The interval concerns the population mean difference \(\mu_d\), not individual patient effects.

The posterior is conditional on the chosen prior and normal model. In particular, a prior with larger \(\kappa_0\) gives more weight to \(m_0\) in the posterior mean, and the scale prior can matter when \(n\) is small. Report the outcome units, contrast direction, prior, and interval. If conclusions are sensitive to plausible prior choices or to a small number of observations, say so rather than presenting one interval as assumption-free. This analysis estimates a mean paired difference; it does not by itself establish causal effects unless the trial design and analysis support a causal interpretation.

Check Your Understanding

Answer each question, then compare your reasoning with the brief solutions.

  1. A paired trial defines \(d_i=\text{treatment}-\text{control}\) on an outcome where lower values are better. What does a negative value of \(\mu_d\) indicate?
  2. For \(n=4\), \(\bar d=1\), \(S_d=6\), and prior parameters \(m_0=0,\kappa_0=2,a_0=1,b_0=2\), calculate \(\kappa_n,m_n,a_n,b_n\).
  3. Why is an interval for \(\mu_d\) not an interval for the effect in every patient?
  4. Name one diagnostic concern specific to the normal model for paired data and one concern about missing pairs.

Solutions. (1) A negative population mean treatment-minus-control difference indicates a lower mean outcome under treatment, which favors treatment for a lower-is-better measure. (2) \(\kappa_n=2+4=6\), \(m_n=[2(0)+4(1)]/6=0.6667\), and \(a_n=1+4/2=3\). Also, \(b_n=2+\frac12[6+(2\cdot4/6)(1-0)^2]=2+\frac12(7.3333)=5.6667\). (3) The model's posterior parameter is the population mean difference; individual effects vary around that mean and are not what this interval summarizes. (4) Strong skewness or an extreme outlier among the patient differences may undermine the normal model. If availability of both measurements depends on outcome or prognosis, analyzing only complete pairs may yield a biased result.

Clinical Biostats