Tutorials › Bayesian Clinical Trials › Posterior Summaries for a Binary Event Rate

Posterior Inference for Trial Endpoints · Tutorial 3 of 696

Posterior Summaries for a Binary Event Rate

Calculate and interpret posterior means, medians, and credible intervals for a binary event rate under a beta-binomial model.

Beginner 10 min read

What You'll Learn

  • Update a beta prior using the number of events and the total number observed.
  • Calculate the posterior mean and understand its relationship to the prior.
  • Define the posterior median and obtain it from the beta cumulative distribution.
  • Construct and interpret an equal-tail credible interval.
  • Compare summaries across trials with different event counts and recognize their limitations.

Why Summarize the Posterior?

A posterior distribution describes uncertainty about a trial event rate, but a single distribution can be difficult to communicate in a protocol discussion, report, or decision meeting. A posterior mean or median gives a central summary, while a credible interval conveys the range of values supported by the posterior. These summaries answer different questions: the mean is an average over posterior values, the median divides posterior probability in half, and an interval describes posterior probability over a range.

This tutorial uses the beta-binomial model established in the earlier material on deriving the beta-binomial posterior. The focus here is how to calculate and interpret its summaries, including what changes when the observed event count is low, high, or intermediate. The event rate \(p\) is the probability of the event for a trial participant represented by the model; it is not automatically a causal effect of treatment.

Model and assumptions: Let \(n\) be the number of participants with observed binary outcomes and let \(r\) be the number who experienced the event. Conditional on a common event rate \(p\), assume the outcomes are independent Bernoulli observations with probability \(p\), so \(r\mid p\sim\operatorname{Binomial}(n,p)\). Assign the prior \(p\sim\operatorname{Beta}(a,b)\), where \(a>0\) and \(b>0\). Under this model, \(p\mid r,n\sim\operatorname{Beta}(a+r,b+n-r)\).

The model assumes a common underlying event rate for the participants being represented and that the recorded outcomes correspond to the binary endpoint of interest. Independence can be questionable when outcomes cluster, such as when participants are recruited in groups with shared risk factors. The model also does not by itself adjust for covariates, missing outcomes, or differences between the trial sample and a target population. Posterior summaries are conditional on the likelihood, prior, and assumptions being appropriate.

Posterior Mean, Median, and Equal-Tail Interval

Write the posterior parameters as \(A=a+r\) and \(B=b+n-r\). The posterior density is a beta density with these parameters. Its mean has a simple closed form; the median and interval endpoints are generally obtained from the beta cumulative distribution function.

Definitions: For \(p\mid r,n\sim\operatorname{Beta}(A,B)\), the posterior mean is \(E[p\mid r,n]=A/(A+B)\). A posterior median \(m\) satisfies \(P(p\leq m\mid r,n)=0.5\). An equal-tail \(100(1-\alpha)\%\) credible interval \((L,U)\) satisfies \(P(p\leq L\mid r,n)=\alpha/2\) and \(P(p\leq U\mid r,n)=1-\alpha/2\).

For example, a 95% equal-tail credible interval uses the 0.025 and 0.975 posterior quantiles. Conditional on the model and observed data, it contains 95% of the posterior probability for \(p\). This is a statement about the posterior distribution, not a claim that there is a 95% probability that a fixed parameter lies in the particular interval after it has been calculated.

The posterior median usually has no elementary formula for general beta parameters. It can be found numerically by solving \(F(m)=0.5\), where \(F\) is the beta cumulative distribution function. Likewise, software typically finds interval endpoints by evaluating beta quantiles. The calculation should use the posterior parameters \(A,B\), not the prior parameters \(a,b\).

Why the Posterior Mean Has This Form

The posterior mean follows directly from the beta density. For \(p\sim\operatorname{Beta}(A,B)\), its density is \(p^{A-1}(1-p)^{B-1}/\mathrm{B}(A,B)\) on \(0<p<1\), where \(\mathrm{B}\) is the beta function. Therefore,

$$ E[p\mid r,n] =\int_0^1 p\,\frac{p^{A-1}(1-p)^{B-1}}{\mathrm{B}(A,B)}\,dp =\frac{\mathrm{B}(A+1,B)}{\mathrm{B}(A,B)} =\frac{A}{A+B}. $$

The last equality uses \(\mathrm{B}(A+1,B)=\frac{A}{A+B}\mathrm{B}(A,B)\). Substituting \(A=a+r\) and \(B=b+n-r\) gives

$$ E[p\mid r,n]=\frac{a+r}{a+b+n}. $$

This expression shows how the prior contributes to the posterior mean. The prior mean is \(a/(a+b)\), and the posterior mean combines the prior information with the observed event count. The prior parameters are not necessarily literal counts of observed participants; their interpretation depends on the prior specification. In particular, the formula does not mean that any prior is harmless when data are sparse.

Worked Summaries for Different Event Counts

Worked Example: No Events in a Small Hypothetical Trial

Suppose a hypothetical trial observes \(n=2\) participants and no events, so \(r=0\). Use a uniform prior \(p\sim\operatorname{Beta}(1,1)\). Calculate the posterior mean, median, and 95% equal-tail credible interval.

The posterior is \(\operatorname{Beta}(1+0,1+2-0)=\operatorname{Beta}(1,3)\). Its mean is

$$ \frac{1}{1+3}=0.2500. $$

For a \(\operatorname{Beta}(1,3)\) distribution, \(F(p)=1-(1-p)^3\). Setting \(F(m)=0.5\) gives \(m=1-(0.5)^{1/3}=0.2063\). The 95% equal-tail endpoints solve \(F(L)=0.025\) and \(F(U)=0.975\):

$$ L=1-(0.975)^{1/3}=0.0084,\qquad U=1-(0.025)^{1/3}=0.7076. $$

Thus the posterior mean event rate is 0.2500, the median is 0.2063, and the 95% credible interval is approximately \((0.0084,0.7076)\), or about 0.84% to 70.76%. The wide interval reflects how little two observations can establish, even though neither participant experienced the event. Zero observed events do not imply that the underlying event rate is exactly zero.

Worked Example: Events in Every Participant

Now suppose a hypothetical trial observes \(n=2\) participants and both experience the event: \(r=2\). Keep the uniform \(\operatorname{Beta}(1,1)\) prior.

The posterior is \(\operatorname{Beta}(1+2,1+2-2)=\operatorname{Beta}(3,1)\). Its mean is \(3/(3+1)=0.7500\). Here \(F(p)=p^3\), so the median is \((0.5)^{1/3}=0.7937\). The 95% equal-tail interval is

$$ L=(0.025)^{1/3}=0.2924,\qquad U=(0.975)^{1/3}=0.9916. $$

The posterior mean is 0.7500, the median is 0.7937, and the interval is approximately \((0.2924,0.9916)\). These summaries are the mirror image of the preceding example because swapping event and non-event counts also swaps the beta parameters under a symmetric prior. The interval remains wide: observing events in both participants is still a very small amount of information about a population event rate.

Worked Example: An Intermediate Event Count

Consider a hypothetical trial with \(n=20\) participants, of whom \(r=10\) experience the event. Again use \(p\sim\operatorname{Beta}(1,1)\).

The posterior is \(\operatorname{Beta}(11,11)\), with mean \(11/(11+11)=0.5000\). Because the posterior is symmetric about 0.5, its median is also 0.5000. Evaluating the beta quantile function gives the 0.025 and 0.975 quantiles as approximately 0.297 and 0.703, respectively. Thus the 95% equal-tail credible interval is approximately \((0.297,0.703)\).

Under the model and prior, the posterior assigns 95% probability to event rates between approximately 0.297 and 0.703. This is substantially narrower than either interval based on two participants. It is still an interval of possible values, not a declaration that the event rate is known to be 0.5. In practice, report the prior, posterior summaries, interval level, and event-rate units or scale together.

Choosing and Reporting a Summary

The mean and median both describe the center of a posterior, but they need not be identical. A skewed posterior can pull the mean toward its longer tail, while the median marks the point with half the posterior probability on each side. For a symmetric beta posterior, such as \(\operatorname{Beta}(11,11)\), they coincide. For an asymmetric posterior, as in the first two examples, they differ.

An equal-tail interval gives equal posterior probability to each tail outside the interval. Other credible intervals, including highest posterior density intervals, use a different construction and can have different endpoints, especially when the posterior is skewed. State which construction is being reported. The equal-tail interval is often convenient because its endpoints are posterior quantiles and its definition applies directly to the beta distribution.

A useful report might say: “With a uniform beta prior and 10 events among 20 participants, the posterior mean event rate was 0.500, and the 95% equal-tail credible interval was 0.297 to 0.703.” This identifies the prior, observed count, central summary, interval type, and uncertainty. If the endpoint is expressed as a percentage, give the interval in percentage points as well—for this example, 50.0% with a 95% interval from 29.7% to 70.3%.

Diagnostics, Pitfalls, and Limitations

For a beta-binomial summary, the arithmetic is usually straightforward; the more important checks concern whether the inputs and assumptions represent the trial. Confirm that \(r\) is an integer from 0 through \(n\), that the event definition is consistent across participants, and that the posterior parameters are \(a+r\) and \(b+n-r\). Check whether outcome dependence, incomplete follow-up, or a prior that has undue influence with sparse data could alter the interpretation. A numerical calculation can be accurate even when the model is unsuitable.

  • Mistake: treating no observed events as proof of zero risk. With \(r=0\), a continuous beta prior with positive parameters yields a posterior over positive event rates, not a point mass at zero. The small-trial example still had a wide interval.
  • Mistake: calling a credible interval a range containing the fixed parameter with 95% probability. The correct interpretation is that, conditional on the model, prior, and observed data, the interval contains 95% of the posterior probability.
  • Mistake: reporting only the observed proportion \(r/n\). The observed proportion is not the posterior mean in general. For the uniform prior, the posterior mean is \((r+1)/(n+2)\); always identify which quantity is being reported.
  • Mistake: overlooking the prior when data are sparse. A prior may have a noticeable influence with few participants. Report it and, where relevant, assess whether reasonable alternative priors produce materially different summaries.
  • Limitation: assuming one event rate fits all participants. If event probabilities vary substantially across sites or participant subgroups, a single-rate beta-binomial model may not capture that structure. Posterior summaries do not repair a misspecified model.

Posterior summaries are compact descriptions, not substitutes for the model or the trial design. A credible interval can be broad even when the mean looks precise to several decimal places, so avoid giving the mean alone. The next inferential question may concern how much posterior probability lies above a clinically relevant benchmark; that is a different summary and should not be confused with reading the interval endpoints.

Check Your Understanding

Try each question, then compare your work with the solutions below.

  1. With prior \(\operatorname{Beta}(1,1)\), what is the posterior distribution after 3 events among 8 participants, and what is its posterior mean?
  2. With prior \(\operatorname{Beta}(1,1)\), zero events among one participant gives which posterior? Find its mean and median.
  3. In one sentence, interpret a 95% equal-tail credible interval for a trial event rate.
  4. Why might the posterior mean and median differ?

Solutions. (1) The posterior is \(\operatorname{Beta}(1+3,1+8-3)=\operatorname{Beta}(4,6)\). Its mean is \(4/(4+6)=0.4000\). (2) The posterior is \(\operatorname{Beta}(1,2)\), with mean \(1/3=0.3333\). Its cumulative distribution is \(F(p)=1-(1-p)^2\), so its median is \(1-\sqrt{0.5}=0.2929\). (3) Conditional on the model, prior, and data, 95% of the posterior probability for the event rate lies between the stated endpoints. (4) For a skewed posterior, the mean is pulled toward the longer tail while the median divides posterior probability in half; the two need not coincide.

Clinical Biostats