From Event Counts to Treatment Contrasts
A two-arm binary endpoint analysis begins with a simple data summary: in each arm, how many participants experienced the event, and how many did not? The Bayesian analysis updates a prior distribution for each arm's event probability using those counts. It then uses the two posterior distributions to describe arm-specific event rates and treatment-control contrasts. The aim is not merely to report a single contrast, but to represent uncertainty about it.
We consider a parallel-arm trial with a binary endpoint measured once for each participant. Let \(X_T\) and \(X_C\) denote event counts in the treatment and control arms, and let \(n_T\) and \(n_C\) be the corresponding numbers of participants with endpoint data. The event probabilities are \(p_T\) and \(p_C\). The analysis below assumes independent participants within each arm, a common event probability within each arm, and independent priors for the two arm probabilities. In a randomized trial, this setup also assumes the endpoint and analysis populations are defined consistently and that missing outcomes do not create unaddressed bias.
The arm-specific posterior means are the posterior expected event rates. For \(p\sim\operatorname{Beta}(a,b)\), \(E[p]=a/(a+b)\). The treatment effect can be expressed in several ways: the risk difference \(p_T-p_C\), the risk ratio \(p_T/p_C\), or the odds ratio \(\{p_T/(1-p_T)\}/\{p_C/(1-p_C)\}\). These contrasts answer different questions. A negative risk difference or a ratio below one indicates a lower event rate in treatment for an adverse endpoint.
Worked Analysis With Independent Beta Priors
Worked Example: Updating Both Arms and Comparing Event Rates
Suppose a hypothetical trial observes 8 events among 100 treatment participants and 14 among 100 control participants. Use independent \(\operatorname{Beta}(1,1)\) priors for \(p_T\) and \(p_C\). The likelihood assumptions are that each participant contributes one binary outcome and that outcomes are independent within and across arms, conditional on the arm probabilities.
For treatment, there are \(100-8=92\) non-events, so the posterior is \(\operatorname{Beta}(1+8,1+92)=\operatorname{Beta}(9,93)\). For control, there are \(100-14=86\) non-events, giving \(\operatorname{Beta}(15,87)\). The posterior means are
Thus, the posterior mean event rates are 8.82% in treatment and 14.71% in control. The posterior mean risk difference is the difference of the two expectations:
This is a posterior mean difference of -5.88 percentage points, treatment minus control. The independent arm posteriors also give a posterior distribution for the difference, not just this mean; its spread is needed to assess uncertainty about the size and direction of the contrast.
For the risk ratio, independence of the two arm posteriors means \(E[p_T/p_C]=E[p_T]E[1/p_C]\). If \(p\sim\operatorname{Beta}(a,b)\) and \(a>1\), then \(E[1/p]=(a+b-1)/(a-1)\). Therefore,
For the odds ratio, the needed beta moments are \(E[p/(1-p)]=a/(b-1)\), provided \(b>1\), and \(E[(1-p)/p]=b/(a-1)\), provided \(a>1\). Both conditions hold here, so
These are the posterior means of the ratio parameters. They are not obtained by taking the ratio of the posterior mean risks: that calculation gives \(0.08824/0.1471\approx0.5999\), which is not the posterior mean risk ratio. A complete report would also summarize the posterior distributions of the contrasts, for example with credible intervals and a posterior probability that the risk difference is below zero.
Why the Contrast Means Have These Forms
The beta moment conditions matter because a ratio can have a finite posterior mean only when the corresponding inverse moment exists. The following short derivation explains the formulas used above. The beta density is proportional to \(p^{a-1}(1-p)^{b-1}\) for \(0<p<1\). Multiplying by \(1/p\) changes the power of \(p\) from \(a-1\) to \(a-2\), which is integrable at zero only when \(a>1\). Using the beta function \(B(a,b)\), the moment is
Similarly, multiplying the density by \(p/(1-p)\) requires \(b>1\), and
Consequently, for independent beta posteriors, the posterior mean risk ratio requires \(a_C>1\), and the posterior mean odds ratio requires both \(b_T>1\) and \(a_C>1\). These conditions apply to the posterior parameters, not just to the prior parameters. Even when a ratio mean exists, it may be highly influenced by posterior probability near a denominator of zero. The full posterior distribution and its quantiles should therefore be examined rather than relying on a mean alone.
Worked Example: Different Priors and a Second Set of Counts
In a separate hypothetical trial, each arm has 30 participants: 6 treatment participants and 9 control participants experience the event. Suppose both arms have independent \(\operatorname{Beta}(2,8)\) priors. The priors have mean \(2/(2+8)=0.20\), so they contribute prior information to both event and non-event counts.
The treatment posterior is \(\operatorname{Beta}(2+6,8+24)=\operatorname{Beta}(8,32)\); the control posterior is \(\operatorname{Beta}(2+9,8+21)=\operatorname{Beta}(11,29)\). Their posterior mean risks are \(8/40=0.2000\) and \(11/40=0.2750\). The posterior mean risk difference is \(0.2000-0.2750=-0.07500\), or -7.50 percentage points.
For the risk ratio, the control posterior has \(a_C=11>1\), so its inverse-probability moment exists:
For the odds ratio, \(b_T=32>1\) and \(a_C=11>1\), so both required moments are finite:
The posterior means suggest lower event risk in treatment for this adverse endpoint. They do not by themselves establish how certain that direction is: a posterior probability such as \(P(p_T<p_C\mid\text{data})\), or a credible interval for a contrast, uses the full joint posterior.
Summarizing Uncertainty and Checking the Analysis
The arm posteriors are independent under the stated model, so joint posterior draws provide a direct way to summarize every contrast. Draw \(p_T^{(m)}\) from its treatment beta posterior and \(p_C^{(m)}\) from its control beta posterior independently for each draw \(m\). For each pair, calculate \(p_T^{(m)}-p_C^{(m)}\), \(p_T^{(m)}/p_C^{(m)}\), and the odds ratio. Quantiles of the resulting draws estimate credible interval endpoints; the fraction of draws with \(p_T^{(m)}<p_C^{(m)}\) estimates \(P(p_T<p_C\mid\text{data})\). For example, a 95% equal-tailed credible interval uses the 2.5th and 97.5th percentiles of the posterior draws. It is a posterior probability statement about the parameter conditional on the model, prior, and observed data.
Check the analysis in a fixed sequence: verify the event and non-event counts in each arm; confirm the prior parameters are assigned to events and non-events as intended; calculate each posterior parameter; and check that every reported contrast uses treatment relative to control. Then check moment conditions before reporting a posterior mean ratio. If a condition fails, do not report an infinite or undefined mean as though it were an ordinary finite summary; use posterior quantiles or probabilities, which may still be well-defined.
Worked Example: Sparse Events and a Finite Odds-Ratio Mean
Suppose a hypothetical trial has 0 events among 20 treatment participants and 2 among 20 control participants, with independent \(\operatorname{Beta}(1,1)\) priors. The treatment posterior is \(\operatorname{Beta}(1,21)\), and the control posterior is \(\operatorname{Beta}(3,19)\). The posterior mean risks are \(1/22=0.04545\) and \(3/22=0.1364\), giving a mean risk difference of \(-2/22=-0.09091\).
The risk ratio mean exists because \(a_C=3>1\). It is
For the odds ratio, the treatment odds moment is \(1/(21-1)=1/20\), not \(1/21\), because \(E[p/(1-p)]=a/(b-1)\). The control inverse-odds moment is \(19/(3-1)=19/2\). Thus the posterior mean odds ratio is
The zero treatment events do not make the posterior treatment risk zero: the proper beta prior leaves positive posterior probability across the interval from zero to one. The posterior mean odds ratio is finite here because both moment conditions hold, though sparse data can still produce substantial uncertainty. Inspecting posterior intervals or draws is especially important in this setting.
Interpretation, Alternatives, and Limitations
The risk difference reports an absolute change in event probability, in percentage points when probabilities are expressed as percentages. The risk ratio compares probabilities, while the odds ratio compares odds; an odds ratio should not be described as a risk ratio, particularly when events are common. These are summaries of the same underlying arm probabilities, but they need not have the same numerical value. State which contrast is primary and keep its direction explicit.
A useful alternative to reporting a contrast mean is to report a posterior median and credible interval, particularly for skewed ratio distributions. Posterior probabilities such as \(P(p_T<p_C\mid\text{data})\) answer a directional question directly. These summaries use the same posterior model; they are not competing models. A frequentist confidence interval is a different inferential framework and should not be interpreted as a posterior probability statement.
The independent-arm model is not appropriate for paired binary observations, where within-person dependence must be represented. It also does not automatically handle stratification, clustering, covariate adjustment, differential follow-up, or time-to-event outcomes. A single common event probability per arm may be inadequate when important subgroups differ. Finally, prior choices can matter with small samples, so report the priors, assess their implications, and consider sensitivity to reasonable alternatives. A lower posterior event rate is evidence under the specified model; it does not by itself prove that treatment caused the difference.
Check Your Understanding
Answer each question using treatment minus control for the risk difference and treatment relative to control for ratios.
- With a \(\operatorname{Beta}(1,1)\) prior, what is the treatment posterior after 5 events and 25 non-events?
- For independent posteriors \(p_T\sim\operatorname{Beta}(4,16)\) and \(p_C\sim\operatorname{Beta}(6,14)\), calculate the posterior mean risk difference.
- For those same posteriors, does the posterior mean risk ratio exist? If so, calculate it.
- Why is the posterior mean odds ratio not generally equal to the odds ratio formed from the two posterior mean risks?
Solutions. (1) The posterior is \(\operatorname{Beta}(1+5,1+25)=\operatorname{Beta}(6,26)\). (2) The posterior mean risks are \(4/20=0.2000\) and \(6/20=0.3000\), so the mean difference is \(-0.1000\). (3) Yes: \(a_C=6>1\). The mean is \((4/20)\{(6+14-1)/(6-1)\}=0.2000(19/5)=0.7600\). (4) The odds ratio's posterior mean is the product of the treatment posterior mean odds and the control posterior mean inverse odds, when both moments exist. In general, expectations of these nonlinear functions are not obtained by applying the functions to the posterior mean risks.