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.
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:
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
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:
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
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
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
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
For the scale parameter,
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
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,
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
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.
| Approach | What it models | When it is appropriate | Key distinction |
|---|---|---|---|
| Paired normal model here | The patient-level differences and their mean | Complete pairs with a reasonably normal difference distribution | Uses the within-patient association through the differences |
| Unpaired two-group model | Separate outcome distributions in unrelated groups | Different patients are observed in the two groups | Does not use the within-patient pairing and is not a substitute for matched data |
| Known-variance normal model | The mean difference with variance treated as known | A known variance is genuinely available and appropriate | Does 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.
- 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?
- 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\).
- Why is an interval for \(\mu_d\) not an interval for the effect in every patient?
- 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.