Why Posterior Covariance Matters
In a hierarchical trial, subgroup effects can be conditionally independent given a shared population mean and still be dependent in the posterior distribution after that mean is integrated out. The distinction matters: posterior covariance describes how uncertainty in one subgroup effect moves with uncertainty in another, and it can affect joint summaries and decisions involving more than one subgroup.
This tutorial derives that covariance for a normal-normal hierarchy with known sampling variances and known between-subgroup variance. The calculation isolates the role of uncertainty in the shared mean. It does not imply that two subgroup effects are identical, nor does it measure their clinical similarity by itself.
The assumptions specify both levels of the model. The observed estimates are independent conditional on their subgroup effects, and the subgroup effects are independent conditional on \(\mu\). Dependence between effects can nevertheless appear after integrating over the uncertain \(\mu\). The known-variance assumption makes the derivation conjugate and exact; it is not a claim that a real clinical analysis must know these variances perfectly.
Deriving the Covariance
First condition on \(\mu\). Combining the normal sampling model and normal subgroup prior gives
The weights \(A_j\) and \(C_j\) sum to one. Conditional on \(\mu\), each subgroup estimate is blended with the shared mean; \(r_j\) is the conditional posterior variance. Because the subgroup effects are conditionally independent given \(\mu\) and the data, their conditional covariance is zero for distinct subgroups \(i\ne j\).
The marginal posterior for \(\mu\) is also normal. Integrating out each \(\theta_j\) gives \(y_j\mid\mu\sim N(\mu,\tau^2+v_j)\), independently across \(j\). Thus, writing \(V_\mu=\operatorname{Var}(\mu\mid y_1,\ldots,y_J)\) and \(M=E(\mu\mid y_1,\ldots,y_J)\),
Now apply the law of total covariance, conditioning on \(\mu\). For distinct subgroups, the first term below is zero, while the second term captures the covariance between the conditional posterior means.
The subgroup observations are fixed when calculating this posterior covariance, so only the shared \(\mu\) varies in the conditional means. The coefficients \(C_i\) and \(C_j\) quantify how much the respective subgroup effects respond to uncertainty in that shared mean. Under the stated model they are positive, as is \(V_\mu\), so the covariance is positive.
Worked Calculations
Worked Example: Two Subgroups With Different Precision
Suppose two hypothetical subgroups have observed effect estimates \(y_1=5\) and \(y_2=1\), in the same clinical effect units. Let \(v_1=4\), \(v_2=9\), \(\tau^2=4\), and \(\mu\sim N(0,100)\). These assumed variances are known for this calculation.
The marginal variances for the subgroup observations given \(\mu\) are \(\tau^2+v_1=8\) and \(\tau^2+v_2=13\). Therefore,
The posterior mean of the shared mean is
The coefficients on \(\mu\) in the subgroup conditional means are \(C_1=4/(4+4)=1/2\) and \(C_2=9/(4+9)=9/13\). Hence the cross-subgroup posterior covariance is
in squared effect units. For context, the marginal posterior means are \(A_1y_1+C_1M=0.5(5)+0.5(3.3122)\approx4.156\) and \(A_2y_2+C_2M=(4/13)(1)+(9/13)(3.3122)\approx2.601\). These are distinct subgroup effects, not a single pooled effect.
Worked Example: Turning Covariance Into Correlation
Using the same hypothetical model and data, calculate the marginal posterior variances of the two subgroup effects and their posterior correlation. The conditional variance of \(\theta_j\) given \(\mu,y_j\) is \(r_j=\tau^2v_j/(\tau^2+v_j)\). The law of total variance adds the variance of the conditional mean:
For subgroup 1, \(r_1=(4)(4)/8=2\) and \(C_1=1/2\). Thus
For subgroup 2, \(r_2=(4)(9)/13=36/13\) and \(C_2=9/13\), giving
Correlation is covariance divided by the product of posterior standard deviations:
The posterior correlation is about 0.408, a dimensionless measure of positive linear association between the two uncertain effects. The covariance, by contrast, is expressed in squared effect units. Neither quantity says that a one-unit change in one subgroup causes a change in the other.
Worked Example: Additional Information About the Shared Mean
Keep the two original subgroups, but suppose a third hypothetical subgroup is also observed, with \(v_3=1\) and the same \(\tau^2=4\). The third estimate's value changes the posterior mean \(M\), but with the variances fixed it is the added precision that changes \(V_\mu\). Its contribution to the precision for \(\mu\) is \(1/(\tau^2+v_3)=1/5\).
The coefficients \(C_1=1/2\) and \(C_2=9/13\) for the original two subgroups have not changed. Their posterior covariance after including the third subgroup is therefore
In this fixed-variance example, the third subgroup supplies information about the common mean, reducing its posterior variance and consequently reducing the covariance between the first two effects. This is a property of the assumed shared-mean model, not proof that the three subgroups have identical treatment effects.
Reading the Result and Checking the Model
The formula \(C_iC_jV_\mu\) helps separate three sources of the covariance's magnitude: how uncertain the common mean remains, and how strongly each subgroup effect responds to it. If the shared mean were known exactly, \(V_\mu=0\), and distinct subgroup effects would have zero posterior covariance under this model. If the mean is uncertain but an effect has little dependence on it, its \(C_j\) is small and its contribution to cross-subgroup covariance is correspondingly limited.
Useful checks include the following:
- Check the conditioning. Conditional independence given \(\mu\) does not imply marginal posterior independence after \(\mu\) is integrated out.
- Check the coefficient. The coefficient of \(\mu\) is \(C_j=v_j/(\tau^2+v_j)\), not \(A_j=\tau^2/(\tau^2+v_j)\). The latter multiplies the observed estimate.
- Check the units. \(V_\mu\) and the covariance have squared effect units; \(C_i\) and \(C_j\) are dimensionless.
- Check the bounds on correlation. A calculated correlation must lie between \(-1\) and \(1\). A value outside that range signals an arithmetic or variance calculation error.
- Check the model assumptions. Unexpected negative dependence or a large mismatch between model-based dependence and clinical knowledge may indicate that the shared-mean structure is inadequate or that important subgroup differences are not represented.
A common mistake is to substitute the posterior mean \(M\) for \(\mu\) and conclude that the subgroup effects have zero covariance because they are independent conditional on that fixed value. That calculation describes a conditional posterior with \(\mu\) held fixed, not the marginal posterior. The correction is to integrate over posterior uncertainty in \(\mu\), using the law of total covariance; in this model that adds \(C_iC_jV_\mu\).
Comparison and Limitations
The result applies to the specified normal-normal hierarchy. It should not be transferred unchanged to models with non-normal outcomes, correlated sampling errors, or additional shared parameters. If \(\tau^2\) is itself uncertain, conditioning on it and then integrating it out can add further dependence; the simple expression derived here assumes \(\tau^2\) is fixed and known.
| Approach | Relation between distinct subgroup effects | What it represents |
|---|---|---|
| Shared uncertain \(\mu\), as derived here | Positive marginal posterior covariance \(C_iC_jV_\mu\) | Partial pooling with posterior uncertainty in the common mean retained |
| Shared \(\mu\) fixed at a known value | Zero covariance under the conditional independence assumptions | Dependence through uncertainty in the mean has been removed |
| No pooling with independent subgroup priors | Zero covariance if no other shared parameters link the subgroups | Each subgroup is analyzed without a shared population distribution |
| Complete pooling | Effects are constrained to be the same parameter | A different model and estimand, not merely a covariance adjustment |
Partial pooling can be useful when subgroup effects are plausibly related but not identical. The covariance quantifies one consequence of that structure, but it does not settle whether exchangeability is scientifically appropriate. In particular, a positive covariance is not evidence that treatment effects are causally linked across subgroups. Its meaning depends on the trial design, the effect scale, and the plausibility of the shared-mean assumptions.
Check Your Understanding
Use the model and assumptions stated above. Solutions follow the questions so that each calculation can be checked.
- In a two-subgroup model, \(C_1=0.4\), \(C_2=0.7\), and \(V_\mu=2\). Find the posterior covariance and state its units relative to the effect scale.
- Why can the subgroup effects have nonzero posterior covariance even though they are independent conditional on \(\mu\)?
- If \(\mu\) is known exactly and the conditional independence assumptions hold, what is the covariance between distinct subgroup effects?
- In the first worked example, what role does the third subgroup play in changing the covariance of the first two effects?
Solutions. (1) The covariance is \(C_1C_2V_\mu=(0.4)(0.7)(2)=0.56\), in squared effect units. (2) Integrating over uncertain \(\mu\) makes the conditional posterior means move together; the covariance of those means is \(C_1C_2V_\mu\). (3) It is zero, since \(V_\mu=0\) and the conditional covariance is zero. (4) Its observed value affects the posterior mean, while its known sampling and hierarchy variances add \(1/5\) to the precision for \(\mu\); this lowers \(V_\mu\) from \(2600/551\) to \(2600/1071\), reducing the covariance of the first two effects to \(100/119\approx0.8403\).