Tutorials › Bayesian Clinical Trials › From Trial Data to an Endpoint Posterior

Posterior Inference for Trial Endpoints · Tutorial 1 of 696

From Trial Data to an Endpoint Posterior

Learn to connect a binary endpoint’s sampling model and prior to a posterior, while keeping uncertainty about the event rate distinct from variation in trial outcomes.

Beginner 10 min read

What You'll Learn

  • Define a binary endpoint event rate and its trial likelihood.
  • Explain how Bayes’ rule combines a likelihood with a prior.
  • Calculate posterior probabilities from a finite prior in hypothetical trial examples.
  • Distinguish parameter uncertainty from variation in outcomes across repeated trials.
  • Check the modeling assumptions and recognize when a simple common-rate model may not fit.

From an Observed Endpoint to an Event Rate

A binary clinical-trial endpoint records one of two outcomes for each participant by a specified time: for example, whether a participant experienced an event by day 30. The trial data are the observed outcomes. The event rate is not itself observed; it is an unknown quantity used to describe the chance of an event under a statistical model. Bayesian inference connects these two things by combining the likelihood of the observed data at different possible event rates with a prior distribution over those rates.

The distinction matters in practice. If 3 of 10 hypothetical participants experience the endpoint, the observed proportion is 0.30. That number summarizes the data, but it does not by itself express all the uncertainty about the underlying event rate. A posterior distribution represents uncertainty about that rate after accounting for both the trial data and the prior.

Definition: Let \(Y_i=1\) if participant \(i\) experiences the specified binary endpoint and \(Y_i=0\) otherwise. Let \(p\) be the probability of the endpoint for a participant in the population represented by the model. The number of observed events is \(X=\sum_{i=1}^{n}Y_i\). A prior distribution describes uncertainty about \(p\) before using the current trial data. A likelihood describes how compatible the observed data are with each possible value of \(p\). The posterior distribution describes uncertainty about \(p\) after combining the prior and the likelihood using Bayes’ rule.

The Model and the Bayesian Update

For a simple single-arm illustration, suppose the endpoint is fully observed for \(n\) participants and, conditional on a common event rate \(p\), their outcomes are independent Bernoulli observations. Thus each \(Y_i\) has probability \(p\) of being 1 and probability \(1-p\) of being 0. This model treats the endpoint definition and assessment time as fixed, and assumes the participants share one event rate. It also assumes that the observed outcomes are not selectively missing. These assumptions are substantive: a changing event rate over follow-up, strong dependence between participants, or important differences between participant subgroups may call for a different model.

If only the number of events \(x\) is retained, then \(X\), the event count, has a binomial sampling distribution under these assumptions. The probability of observing \(x\) events at a proposed rate \(p\) is the likelihood as a function of \(p\). The prior and posterior may be discrete distributions, as in the examples below, or continuous distributions.

$$ P(X=x\mid p)=\binom{n}{x}p^x(1-p)^{n-x}, \qquad x=0,1,\ldots,n,\quad 0\leq p\leq 1. $$

Bayes’ rule says that posterior probability is proportional to prior probability multiplied by likelihood. For a finite set of possible rates \(p_1,\ldots,p_K\), with prior probabilities \(\pi_1,\ldots,\pi_K\), the normalized update is:

$$ P(p=p_j\mid X=x) = \frac{P(X=x\mid p_j)\,P(p=p_j)} {\sum_{k=1}^{K}P(X=x\mid p_k)\,P(p=p_k)}. $$

The denominator is the prior predictive probability of the observed count: it averages the sampling probability over the prior. It makes the posterior probabilities sum to 1. For a continuous prior with density \(\pi(p)\), the same logic gives a posterior density proportional to \(P(X=x\mid p)\pi(p)\); its normalizing constant is the integral of that product over the parameter space. No special prior family is required for this principle, provided the prior and likelihood yield a finite, positive normalizing constant for the observed data.

Worked Updates for a Small Binary Trial

Worked Example: Updating a Three-Point Prior

Hypothetical data. In a small trial, 3 of 10 participants experience a specified endpoint. Before seeing these data, an analyst assigns prior probability 0.25 to \(p=0.1\), probability 0.50 to \(p=0.3\), and probability 0.25 to \(p=0.5\). These probabilities sum to 1, so they define a prior on the three candidate rates.

Under the independent, common-rate binomial model, the likelihood at each candidate rate is \(\binom{10}{3}p^3(1-p)^7\). The resulting sampling probabilities, which include the binomial coefficient, are:

$$ \begin{aligned} P(X=3\mid p=0.1)&=120(0.1)^3(0.9)^7\approx 0.05740,\\ P(X=3\mid p=0.3)&=120(0.3)^3(0.7)^7\approx 0.2668,\\ P(X=3\mid p=0.5)&=120(0.5)^3(0.5)^7\approx 0.1172. \end{aligned} $$

Multiply each likelihood by its prior probability. The unnormalized posterior weights are \(0.05740(0.25)=0.01435\), \(0.2668(0.50)=0.1334\), and \(0.1172(0.25)=0.02930\). Their sum, the prior predictive probability of observing 3 events, is approximately \(0.1771\). Dividing each weight by that sum gives:

$$ \begin{aligned} P(p=0.1\mid X=3)&\approx 0.01435/0.1771=0.0810,\\ P(p=0.3\mid X=3)&\approx 0.1334/0.1771=0.7535,\\ P(p=0.5\mid X=3)&\approx 0.02930/0.1771=0.1655. \end{aligned} $$

The posterior assigns about 0.7535 probability to \(p=0.3\), given this prior, this model, and the observed count. This is a probability about the unknown rate within the stated model, not a claim that the true event rate must equal 0.3. The observed proportion is \(3/10=0.30\); its numerical match to one candidate rate does not make the two concepts identical.

Worked Example: The Same Data With a Different Prior

Use the same hypothetical count, 3 events among 10 participants, but assign equal prior probabilities to \(p=0.1\), \(p=0.3\), and \(p=0.5\). The binomial likelihood values are unchanged because the data and sampling model are unchanged. The unnormalized posterior weights are now \(0.05740/3=0.01913\), \(0.2668/3=0.08894\), and \(0.1172/3=0.03906\). The common factor \(1/3\) cancels on normalization, so the posterior probabilities are the likelihood values divided by their sum, \(0.4414\):

$$ (0.05740,\ 0.2668,\ 0.1172)/0.4414 \approx (0.1300,\ 0.6045,\ 0.2654). $$

The posterior probability assigned to \(p=0.3\) is now about 0.6045, rather than 0.7535 under the prior in the preceding example. Both calculations use the same trial data and model; the difference comes from the prior. This is why a posterior should be reported together with its prior specification and modeling assumptions. The example also shows that a prior is not a decorative step: it contributes to the update, especially when the data are limited.

Worked Example: Comparing Two Candidate Rates

Suppose a hypothetical trial observes 4 endpoint events among 12 participants. An analyst assigns prior probability 0.5 to each of two candidate rates, \(p=0.25\) and \(p=0.5\). With equal prior probabilities, the posterior odds for the first candidate rate against the second equal the likelihood ratio. The binomial coefficient is the same at both rates and cancels:

$$ \frac{P(X=4\mid p=0.25)}{P(X=4\mid p=0.5)} = \left(\frac{0.25}{0.5}\right)^4 \left(\frac{0.75}{0.5}\right)^8 =0.5^4(1.5)^8 \approx 1.602. $$

Thus the posterior odds are about 1.602 to 1 in favor of \(p=0.25\). The corresponding posterior probability is \(1.602/(1+1.602)\approx 0.6157\) for \(p=0.25\), with probability \(1-0.6157=0.3843\) for \(p=0.5\). This is a relative update between the two rates included in this prior; it says nothing directly about rates the prior did not include.

Why the Update Works—and What Is Uncertain

The update follows directly from the definition of conditional probability. For a candidate rate \(p_j\), the joint probability of that rate and the observed count is the probability of the count conditional on the rate multiplied by the prior probability of the rate. Dividing by the probability of the observed count gives the conditional probability of the rate after observing the count:

$$ P(p=p_j,X=x)=P(X=x\mid p_j)P(p=p_j), \qquad P(p=p_j\mid X=x)=\frac{P(p=p_j,X=x)}{P(X=x)}. $$

The denominator \(P(X=x)\) is obtained by adding the joint probabilities over all candidate rates. Substituting this sum produces the finite-prior formula above. This derivation shows why posterior weights are likelihood times prior and why they must be normalized.

Two kinds of uncertainty should not be conflated. Sampling variation concerns how the observed count could differ if another trial were conducted at the same event rate; it is described by the sampling model \(P(X=x\mid p)\). Parameter uncertainty concerns which values of \(p\) remain plausible after seeing the current data; it is represented by the posterior distribution. The observed count is fixed once the trial has been completed, while the posterior describes uncertainty about the rate under the model and prior.

For example, a posterior probability such as \(P(p=0.3\mid X=3)=0.7535\) is not the probability that a future participant will experience the endpoint. In the finite-prior example, the posterior predictive probability for a future participant’s event is the posterior-weighted average of the candidate rates:

$$ P(Y_{\mathrm{new}}=1\mid X=3) =\sum_j p_jP(p=p_j\mid X=3) \approx 0.1(0.0810)+0.3(0.7535)+0.5(0.1655) \approx 0.3169. $$

This quantity is a predictive probability for a new participant under the model. It is distinct from a posterior probability about a candidate value of \(p\), and it relies on the assumption that the new participant shares the same event rate.

Assumptions, Diagnostics, and Alternatives

A simple binomial model can be useful for explaining an endpoint update, but its assumptions must be assessed in the trial context. The endpoint and observation window should be defined consistently; participants should have outcomes ascertained in a way compatible with the model; and a shared event rate should be a reasonable approximation for the target population. Independence can be questionable when outcomes cluster by site, household, or another shared factor. Likewise, substantial variation in risk across participants can make a single common-rate description inadequate.

A useful diagnostic is to compare the observed data with what the proposed model could plausibly generate. For a simple binary count, consider whether the event count is surprising under the range of rates receiving meaningful prior probability. At the participant level, examine whether event patterns vary systematically by site, time, or baseline characteristics. These checks do not prove the model correct; they can reveal a mismatch that motivates a richer model or a narrower interpretation. Prior sensitivity is also informative: recomputing the posterior under other defensible priors shows how much the conclusion depends on prior choices when the sample is small.

A frequentist analysis of a binary endpoint can instead emphasize a point estimate and a confidence interval with repeated-sampling coverage properties. A likelihood-based analysis can compare how well different parameter values explain the observed data without assigning prior probabilities to them. Bayesian analysis makes the prior explicit and yields a posterior distribution that can directly express probabilities about parameters, conditional on the model and prior. These approaches answer related but not identical questions; none removes the need to define the endpoint and justify the sampling assumptions.

Common pitfall: Treating the observed proportion \(x/n\) as if it were the known event rate, or interpreting a posterior probability as a probability about a future outcome. The proportion is a data summary; the posterior describes uncertainty about \(p\); and a future-outcome probability is obtained by predicting under the model and averaging over posterior uncertainty. Also, a posterior probability is conditional on the chosen prior and likelihood, not evidence that the model assumptions are automatically true.

The finite-prior examples make the mechanics transparent, but they also illustrate a limitation: posterior probability can be assigned only to values included in the prior’s support. For clinical inference, a prior should represent defensible knowledge about the event rate and should allow values that are scientifically possible. More flexible priors and models can represent a continuum of rates, covariates, or between-participant variation, but they do not change the central logic: multiply prior support by data compatibility, then normalize.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. A hypothetical trial observes 2 events among 8 participants. Under the binomial model, write the likelihood as a function of \(p\).
  2. In the three-point prior example, why did changing the prior change the posterior even though the trial data stayed the same?
  3. What is the difference between \(P(p=0.3\mid X=3)\) and the probability that a new participant experiences the endpoint?
  4. Name two assumptions of the simple binomial model and describe one possible warning sign that an assumption may be inadequate.

Solutions. (1) The likelihood is \(P(X=2\mid p)=\binom{8}{2}p^2(1-p)^6=28p^2(1-p)^6\), for \(0\leq p\leq1\). (2) The posterior is proportional to the product of prior probability and likelihood; changing prior probabilities changes the weights before normalization. (3) The first is a posterior probability about a candidate parameter value. The second is a predictive probability for an outcome and, in the finite-prior model, equals the posterior-weighted average of candidate rates. (4) The model assumes independent participant outcomes conditional on a common \(p\), among other conditions. For example, strong clustering by site or systematic risk differences across participants can indicate that independence or a common rate is an inadequate approximation.

Clinical Biostats