Tutorials › Bayesian Clinical Trials › Piecewise-Exponential Survival Likelihoods With Gamma Priors

Posterior Computation · Tutorial 114 of 696

Piecewise-Exponential Survival Likelihoods With Gamma Priors

Learn how event and censoring records determine interval-specific exposure and event counts, and how these quantities update Gamma priors for piecewise-constant hazards.

Intermediate 10 min read

What You'll Learn

  • Define the interval-specific hazard model and its assumptions.
  • Calculate interval event counts and person-time exposure from event and censoring times.
  • Derive the likelihood kernel and independent Gamma posterior updates.
  • Check posterior parameters and identify common data-aggregation errors.
  • Compare the model’s scope with Kaplan–Meier and Cox approaches.

Why split survival time into intervals?

A single exponential event-time model assumes the hazard is constant throughout follow-up. In a clinical trial, however, the event rate may plausibly differ between early and later follow-up. A piecewise-exponential model allows the hazard to be constant within each prespecified time interval while changing between intervals. Its likelihood has a useful structure: each interval contributes an event count and a total time at risk, so independent Gamma priors yield independent Gamma posteriors.

The key data quantity is not simply the number of participants followed. It is the exposure time accumulated in each interval before each participant’s event or censoring time. A participant may contribute exposure to several intervals, but contributes an event to at most one.

Model, observation, and assumptions

Definition: Choose fixed cutpoints \(0=\tau_0<\tau_1<\cdots<\tau_J\), with the last interval allowed to extend indefinitely. In interval \(j\), the event-time hazard is constant at \(\lambda_j>0\). For \(t\) in that interval, the hazard is \(h(t)=\lambda_j\). The interval-specific hazard has units of inverse time.

For each participant, let \(T_i\) be the event time and \(C_i\) the censoring time. The observed follow-up is \(t_i=\min(T_i,C_i)\), and \(\delta_i=1\) if the event is observed and \(\delta_i=0\) if the participant is right-censored. The model here assumes participants enter at time zero, follow-up is recorded on a common time scale, and there are no covariates or competing events.

The censoring mechanism is assumed non-informative for the event-time parameters: after conditioning on any design features used to define the analysis, censoring does not provide additional information about an individual’s unobserved event time. The cutpoints are fixed for the analysis. The model also assumes that the hazard really is adequately represented as constant within each interval. These assumptions matter: the Gamma update is exact for this likelihood, but it does not make an unsuitable hazard model suitable.

Define \(Y_{ij}\) as participant \(i\)’s time at risk in interval \(j\), and \(d_j\) as the number of observed events in that interval. More explicitly,

$$ Y_{ij}=\max\{0,\min(t_i,\tau_j)-\tau_{j-1}\}, \qquad Y_j=\sum_i Y_{ij}, \qquad d_j=\sum_i \delta_i\,I(\tau_{j-1}\leq t_i<\tau_j). $$

For a final interval extending to infinity, use the same exposure definition with its lower endpoint and no finite upper endpoint. An event exactly at a cutpoint can be assigned consistently to one adjacent interval; under a continuous event-time model, the probability of an event exactly at a fixed cutpoint is zero.

From survival contributions to the likelihood

Under the piecewise-constant hazard, a participant’s survival probability to time \(t\) is the exponential of minus the cumulative hazard accumulated up to \(t\). Each fully or partly traversed interval contributes its hazard multiplied by the time spent there. An observed event additionally contributes the hazard in the interval where it occurs; a right-censored observation contributes survival up to censoring but no event-hazard factor.

$$ L(\lambda_1,\ldots,\lambda_J) \ \propto\ \prod_{j=1}^{J}\lambda_j^{d_j}\exp(-\lambda_jY_j). $$

This is a likelihood for the event-time parameters, with the censoring distribution omitted under the non-informative censoring assumption. The expression is a likelihood kernel: terms that do not depend on the hazards are omitted. Its factorization follows because every observed event contributes one factor \(\lambda_j\) in its interval, and every participant’s time at risk contributes the corresponding exponential survival factor.

Prior and posterior: Use independent shape-rate Gamma priors, \(\lambda_j\sim\operatorname{Gamma}(a_j,b_j)\), where \(a_j>0\), \(b_j>0\), and the density is proportional to \(\lambda_j^{a_j-1}\exp(-b_j\lambda_j)\). Then, conditional on the observed data, $$ \lambda_j\mid\text{data}\sim\operatorname{Gamma}(a_j+d_j,\ b_j+Y_j), $$ independently across intervals. The second parameter is a rate, not a scale; \(b_j\) and \(Y_j\) have units of time, so the posterior rate is also in units of time.

Why the Gamma update works

For one interval, multiply its likelihood kernel by its prior density. The powers of the hazard add, as do the coefficients in the negative exponential. This gives exactly the kernel of another shape-rate Gamma distribution.

$$ \begin{aligned} p(\lambda_j\mid\text{data}) &\propto \lambda_j^{d_j}\exp(-Y_j\lambda_j) \lambda_j^{a_j-1}\exp(-b_j\lambda_j)\\ &= \lambda_j^{a_j+d_j-1} \exp\bigl(-(b_j+Y_j)\lambda_j\bigr). \end{aligned} $$

The likelihood is a product over intervals, and the prior is independent across intervals. Their product therefore remains a product of interval-specific Gamma kernels. Normalizing each kernel gives the stated posterior distributions and their posterior independence. If the prior instead links hazards across intervals, the likelihood still factors, but the joint posterior need not be independent.

Worked Example: Counting Exposure Across Two Intervals

Suppose five hypothetical participants are followed in years, with intervals \([0,2)\) and \([2,5)\). Their records are: events at 0.8, 1.6, 3.2, and 4.5 years, and censoring at 4.0 years. Assume independent \(\operatorname{Gamma}(1,2)\) priors for both hazards, using the shape-rate convention.

In the first interval, the five participants contribute \(0.8\), \(1.6\), \(2\), \(2\), and \(2\) years. Thus \(Y_1=0.8+1.6+2+2+2=8.4\) person-years, and the two events before year 2 give \(d_1=2\).

In the second interval, the event at 3.2 contributes \(3.2-2=1.2\) years; censoring at 4.0 contributes 2 years; and the event at 4.5 contributes 2.5 years. The other two participants had events before entering this interval. Therefore \(Y_2=1.2+2+2.5=5.7\) person-years, and \(d_2=2\).

The posterior parameters are shape \(a_j+d_j\) and rate \(b_j+Y_j\). Hence

$$ \lambda_1\mid\text{data}\sim\operatorname{Gamma}(1+2,2+8.4) =\operatorname{Gamma}(3,10.4), \qquad \lambda_2\mid\text{data}\sim\operatorname{Gamma}(1+2,2+5.7) =\operatorname{Gamma}(3,7.7). $$

For a shape-rate Gamma distribution, the mean is shape divided by rate. The posterior mean hazards are therefore \(3/10.4=0.2885\) events per person-year in the first interval and \(3/7.7=0.3896\) events per person-year in the second. These are posterior summaries under the specified model and priors, not proof that the true hazard is constant within either interval.

Worked Example: An Interval With No Events

In a hypothetical trial, suppose a single interval has 7 person-years of exposure and no observed events. Use a \(\operatorname{Gamma}(0.5,1)\) prior for its hazard, with time measured in years.

Here \(d=0\) and \(Y=7\). The posterior is

$$ \lambda\mid\text{data}\sim \operatorname{Gamma}(0.5+0,1+7) =\operatorname{Gamma}(0.5,8). $$

Its posterior mean is \(0.5/8=0.0625\) events per person-year. No events does not mean zero exposure or a zero posterior hazard: the seven person-years update the rate parameter, while the prior supplies a positive shape. This example also shows why a zero event count is not, by itself, a reason to discard an interval.

Worked Example: Auditing Exposure With Censoring

Consider six hypothetical participants followed in years, with intervals \([0,1)\) and \([1,2)\). Events occur at 0.4, 0.7, 1.4, and 1.8 years; the other two participants are censored at 1.2 and 2.0 years. Let both interval priors be \(\operatorname{Gamma}(2,3)\).

Every participant with follow-up beyond year 1 contributes one full year to the first interval. The total exposure there is \(0.4+0.7+1+1+1+1=5.1\) person-years, with two events, so \(d_1=2\). In the second interval, the events at 1.4 and 1.8 contribute 0.4 and 0.8 years; censoring at 1.2 contributes 0.2 years; and censoring at 2.0 contributes one year. Thus \(Y_2=0.4+0.8+0.2+1=2.4\) person-years and \(d_2=2\).

Applying the update gives

$$ \lambda_1\mid\text{data}\sim\operatorname{Gamma}(2+2,3+5.1) =\operatorname{Gamma}(4,8.1), \qquad \lambda_2\mid\text{data}\sim\operatorname{Gamma}(2+2,3+2.4) =\operatorname{Gamma}(4,5.4). $$

The participant censored at 1.2 years contributes exposure in both intervals but contributes no event in either. The participant censored at year 2 contributes one full year to each. Counting only participants still under observation at the end of each interval would fail to represent the person-time that generated the survival likelihood.

Checking the analysis and choosing an approach

Before interpreting posterior summaries, audit the data reduction. The most useful checks are simple: the event counts across intervals should sum to the total number of observed events; each participant’s exposure contributions should sum to that participant’s observed follow-up; and all interval exposures and prior rates should be nonnegative, with prior shape and rate strictly positive. Check time units as well. If follow-up is recorded in months, exposure and prior rate must use compatible units.

A further diagnostic is to compare the observed event pattern with the assumed interval structure. If event rates appear to change sharply within an interval, or if the chosen cutpoints leave very little exposure in some intervals, the piecewise-constant approximation may be too crude or weakly informed by data. A prior predictive check can help assess whether the prior hazards imply plausible survival patterns. Changing cutpoints after inspecting outcomes can also introduce model-selection concerns; the simple conjugate update does not account for uncertainty about the cutpoints.

The piecewise-exponential model is parametric within intervals and offers direct posterior distributions for interval hazards. The Kaplan–Meier estimator instead gives a nonparametric estimate of the survival curve at observed event times, while the Cox model uses a semiparametric hazard specification, commonly to study covariate associations. These alternatives address different goals; they do not produce the same interval-specific Gamma update. A single exponential model is simpler but imposes one hazard over all follow-up. The piecewise version relaxes that restriction at the cost of choosing intervals and estimating more hazards.

Important limitations include sensitivity to interval boundaries, sparse event information in some intervals, and the assumption of independent censoring. With no observed events in an interval, the posterior depends appreciably on the prior and exposure; with little exposure, the data provide little updating even if the prior is proper. The model as stated also does not handle delayed entry, time-varying covariates, competing risks, or dependence between participants. Such settings require a likelihood that represents those features rather than a mechanical use of these formulas.

Common mistakes

  • Wrong: Treating every participant as one unit of exposure in every interval they enter. Correction: Count only the time actually spent at risk in that interval, stopping at event or censoring.
  • Wrong: Adding an event to every interval traversed by a participant. Correction: An observed event contributes to exactly one interval; censoring contributes exposure but no event count.
  • Wrong: Using a Gamma scale parameter as though it were a rate. Correction: Under the shape-rate convention here, posterior rate is prior rate plus exposure, \(b_j+Y_j\).
  • Wrong: Interpreting a conjugate update as evidence that the hazards are constant within the selected intervals. Correction: Conjugacy is an algebraic result conditional on the model; assess whether the interval structure is credible.
Key takeaway: For each fixed interval, reduce the survival records to an observed event count \(d_j\) and total exposure \(Y_j\). With an independent \(\operatorname{Gamma}(a_j,b_j)\) shape-rate prior, the posterior is \(\operatorname{Gamma}(a_j+d_j,b_j+Y_j)\), subject to the survival, censoring, and piecewise-constant hazard assumptions.

Check Your Understanding

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

  1. In a hypothetical interval, there are 3 observed events and 12 person-years of exposure. With a \(\operatorname{Gamma}(2,4)\) shape-rate prior, what is the posterior?
  2. A participant is event-free and censored after 1.5 years in an interval that began at year 1. How much exposure and how many events does this participant contribute to that interval?
  3. Explain why the likelihood contains an exponential term involving total exposure, even when some participants are censored.
  4. In two intervals, the prior hazards are independent and the likelihood factors by interval. What does this imply about the posterior dependence of the hazards?

Solutions. (1) The posterior is \(\operatorname{Gamma}(2+3,4+12)=\operatorname{Gamma}(5,16)\). (2) The participant contributes \(1.5-1=0.5\) time units of exposure and zero events. (3) Censoring records survival without an observed event up to the censoring time, so it contributes to accumulated time at risk and hence to the exponential survival factor. (4) The posterior also factors by interval, so the hazards remain posterior independent under these independent priors and this likelihood.

Clinical Biostats