Event-Time Data and the Exponential Model
In a survival trial, the endpoint may be the time from randomization to an event such as disease progression or death. When every participant's event is observed, each person contributes a complete event time. A simple model for such data assumes that event times are independent and follow an exponential distribution with a common rate. This tutorial derives the likelihood and posterior for that setting, given a gamma prior on the rate.
Let \(T_i\) be the event time for participant \(i\), measured from a clearly specified common time origin. The exponential rate \(\lambda\) is positive and has units of inverse time; for example, if time is measured in months, \(\lambda\) is measured in events per month at the individual hazard level. The model implies a constant instantaneous event rate over time, conditional on remaining event-free.
The model assumes one common rate for all included participants, independent event times conditional on that rate, accurate event-time measurement, and complete observation of the event for each participant. It also assumes the exponential distribution is adequate: its constant hazard rules out systematic changes in event risk over time. These are substantive modeling assumptions, not consequences of using a gamma prior.
Likelihood From Complete Event Times
Write the observed event times as \(t_1,\ldots,t_n\), and let \(S=\sum_{i=1}^{n}t_i\) be their total. Conditional independence means the joint density is the product of the individual densities. As a function of \(\lambda\), this product is the likelihood.
The observed times enter this likelihood through \(n\), the number of events, and \(S\), the total observed event time. In the complete-data setting, the individual times do not otherwise appear in the likelihood for \(\lambda\). This does not mean they are irrelevant to checking the model: their pattern over time can reveal whether a constant hazard is questionable.
Worked Example: Writing the Likelihood for Four Events
Suppose, hypothetically, that four participants in a trial have observed event times of 2, 3, 5, and 6 months. Assume for this calculation that their times are independent and share an exponential rate \(\lambda\), measured per month. The total observed time is \(S=2+3+5+6=16\) months.
The likelihood is the product of four exponential densities:
The power four reflects the four observed events; the exponent uses 16 months of total event time. The likelihood has units consistent with four event-time densities. Its maximum occurs at \(\hat{\lambda}=n/S=4/16=0.25\) per month, but this likelihood calculation alone is not a Bayesian posterior: the prior distribution is also needed.
Gamma Prior and Posterior
Use the shape-rate parameterization for the gamma prior. The rate parameter in this prior is not the event rate \(\lambda\); it is a hyperparameter with units of time. Distinguishing these quantities avoids a common units error.
Bayes' rule says that the posterior density is proportional to the likelihood times the prior density. Substituting the complete-data likelihood and the gamma prior gives a kernel proportional to a power of \(\lambda\) times an exponential function of \(\lambda\). The gamma integral supplies the normalizing constant.
For \(c>0\) and \(r>0\), the gamma integral is \(\int_0^\infty \lambda^{r-1}e^{-c\lambda}\,d\lambda=\Gamma(r)/c^r\). Applying it with \(r=a+n\) and \(c=b+S\) shows that the normalizing constant for the posterior kernel is \((b+S)^{a+n}/\Gamma(a+n)\). Thus the posterior is a gamma distribution with updated shape and rate:
For a gamma distribution with shape \(r\) and rate \(c\), the posterior mean is \(r/c\), and the variance is \(r/c^2\). In this application the posterior mean has units of inverse time, and the variance has units of inverse time squared. These summaries describe uncertainty about the common event rate under the stated model and prior; they do not assert that the rate is known to be constant in the actual clinical population.
Worked Example: Posterior Rate and Probability Below a Threshold
Suppose, hypothetically, that five participants have complete event times of 3, 4, 5, 8, and 10 months, for a total of \(S=30\) months. Let the prior be \(\operatorname{Gamma}(2,12)\), with the rate hyperparameter 12 measured in months. The prior is proper and places support only on positive event rates, as required by the exponential model.
The posterior is \(\operatorname{Gamma}(2+5,12+30)=\operatorname{Gamma}(7,42)\). The posterior mean and variance are therefore
The posterior standard deviation is \(\sqrt{7/1764}=0.06299\) per month (to five decimal places). For another posterior summary, calculate the probability that the rate is below 0.1 per month. For an integer-shape gamma distribution with shape 7 and rate 42, its cumulative probability at \(x=0.1\) is \(1-e^{-42x}\sum_{k=0}^{6}(42x)^k/k!\). Here \(42x=4.2\), so
Thus, under this model and prior, the posterior probability that the common event rate is below 0.1 per month is about 13.25%. This is a probability statement about \(\lambda\) conditional on the data and model, not a probability that a particular participant will experience an event by a specified time.
What the Update Uses—and What Can Go Wrong
The posterior update is compact, but its validity depends on the data and model matching the derivation. Before using it, verify that each included participant has a recorded event time rather than a last known event-free time. With right-censored observations, the likelihood contribution is different; the earlier material on the likelihood for right-censored trial survival data addresses that distinction. Do not treat a censoring time as if it were an observed event time.
Also check that event times share a meaningful time origin and the same time unit. A total of 30 months cannot be combined with a prior rate hyperparameter expressed in years without conversion. Inspect event-time patterns and clinical knowledge for evidence against a constant hazard, such as a pronounced early risk period followed by a lower rate. Dependence among participants, unequal underlying rates, or changing treatment exposure can also undermine the common-rate independent model.
A simple check is to compare the exponential model's implied pattern with the observed event-time pattern, while recognizing that a small trial may have little power to diagnose departures. Strong time trends or systematic differences across clinically important groups are reasons to consider a richer model. Weibull and piecewise-exponential models are alternatives when a constant hazard is not plausible; they change the model rather than merely changing the prior. For incomplete follow-up, use a likelihood that accounts for the observed censoring information instead of applying the complete-data formula.
Worked Example: Assessing Sensitivity to the Prior
Use the same hypothetical five event times, whose total is 30 months, but consider a second proper prior, \(\operatorname{Gamma}(1,10)\). This prior has positive support and a different shape and rate from the preceding example. It is being compared to show how prior choice can affect a posterior with limited data, not to claim that either prior is universally suitable.
The posterior under this alternative prior is \(\operatorname{Gamma}(1+5,10+30)=\operatorname{Gamma}(6,40)\), with mean \(6/40=0.15\) per month. To compare a probability on the same scale, for shape 6 the gamma cumulative probability at \(x=0.1\) is \(1-e^{-40(0.1)}\sum_{k=0}^{5}(40(0.1))^k/k!\). The sum is \(1+4+8+10.6667+10.6667+8.5333=42.8667\). Therefore
The threshold probability is about 21.49% here, compared with about 13.25% under the \(\operatorname{Gamma}(2,12)\) prior. Both analyses use the same event times and likelihood, so the difference reflects the prior's contribution to the posterior. This contrast motivates checking whether a conclusion is sensitive to scientifically plausible prior choices.
Common Mistakes and Interpretation
- Using the wrong gamma parameterization. In this tutorial \(\operatorname{Gamma}(a,b)\) uses rate \(b\), not scale \(b\). Its mean is \(a/b\), not \(ab\).
- Mixing time units. If event times are in months, \(S\) is in months and the prior rate parameter \(b\) must also be in months. The posterior rate for \(\lambda\) is then in events per month.
- Calling a censored time an event time. A participant known to be event-free through month 8 has not necessarily had an event at month 8. Including 8 as a complete event time changes the likelihood incorrectly.
- Ignoring the constant-hazard assumption. A gamma prior does not make an exponential model flexible over time. If the hazard changes, the model may be unsuitable even when its posterior calculation is correct.
- Overstating a posterior probability. A posterior probability such as \(P(\lambda<0.1\mid\text{data})\) is conditional on the model, prior, and observed data. It is not a probability that the model assumptions are true.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- Four complete event times total 20 weeks. Write the likelihood as a function of the common exponential rate \(\lambda\).
- With a \(\operatorname{Gamma}(3,8)\) shape-rate prior, what is the posterior after six complete events totaling 24 weeks? State the posterior mean and units.
- Why is a participant's last event-free visit not automatically a complete event time?
- For the model in this tutorial, what is the role of the total observed event time \(S\), and what assumption makes it appropriate to summarize the data using \(n\) and \(S\)?
Solutions. (1) The likelihood is \(L(\lambda)=\lambda^4e^{-20\lambda}\), since there are four event times and their total is 20 weeks. (2) The posterior is \(\operatorname{Gamma}(3+6,8+24)=\operatorname{Gamma}(9,32)\). Its mean is \(9/32=0.2813\) events per week. (3) The participant is only known to have remained event-free through that visit; the event time may occur later or may be unobserved. The observation is censored, not a complete event time. (4) \(S\) contributes the total exposure time in the likelihood's exponential factor, while \(n\) supplies the rate's power. Conditional independence and a common exponential rate yield \(L(\lambda)=\lambda^n e^{-\lambda S}\); those assumptions justify this reduction for inference on \(\lambda\).