Tutorials › Bayesian Clinical Trials › Weibull Posterior Inference With a Fixed Shape

Posterior Inference for Trial Endpoints · Tutorial 27 of 696

Weibull Posterior Inference With a Fixed Shape

Learn how fixed-shape Weibull survival data produce a Gamma posterior for the rate and how to use it to summarize survival.

Beginner 10 min read

What You'll Learn

  • Write the Weibull density, hazard, and survival function using a fixed shape and a rate parameter.
  • Derive the likelihood contribution for an event and for a right-censored observation.
  • Update a Gamma shape-rate prior using the event count and transformed follow-up times.
  • Calculate posterior mean survival at a specified time and distinguish it from a plug-in estimate.
  • Identify assumptions and diagnostics relevant to fixed-shape Weibull inference.

Why Use a Weibull Model With Fixed Shape?

Survival data record how long it takes for an event to occur, but follow-up may end before every participant experiences the event. A Weibull model represents event times with a hazard that can increase, decrease, or remain constant over time. Fixing its shape parameter leaves one unknown rate parameter, for which a Gamma prior gives a convenient conjugate posterior—even when observations are right-censored.

The fixed shape is a substantive modeling choice, not just a computational convenience. The analysis treats the shape as known and focuses uncertainty on the rate. If that shape is poorly chosen, the posterior can be precise about a model that does not adequately describe the event-time pattern.

Model and Likelihood Contributions

Definition: Let \(T\) be a positive event time. Under a Weibull model with fixed shape \(k>0\) and unknown rate \(\lambda>0\), the survival function, density, and hazard are $$ S(t\mid\lambda,k)=\exp(-\lambda t^k), \qquad f(t\mid\lambda,k)=k\lambda t^{k-1}\exp(-\lambda t^k), \qquad h(t\mid\lambda,k)=k\lambda t^{k-1}, $$ for \(t>0\). Here \(k\) is dimensionless, and \(\lambda\) has units of time\(^{-k}\). In particular, when \(k=1\), this is the exponential model with constant hazard \(\lambda\).

For participant \(i\), let \(Y_i\) be the observed follow-up time and let \(\delta_i=1\) if the event was observed, or \(\delta_i=0\) if follow-up ended before the event. An observed event contributes the density at \(Y_i\); a right-censored observation contributes the probability of surviving beyond \(Y_i\). Conditional on \(\lambda\), the contribution can therefore be written

$$ L_i(\lambda)= \bigl[f(Y_i\mid\lambda,k)\bigr]^{\delta_i} \bigl[S(Y_i\mid\lambda,k)\bigr]^{1-\delta_i}. $$

Substituting the Weibull density and survival function gives

$$ L_i(\lambda)= \bigl(k\lambda Y_i^{k-1}\bigr)^{\delta_i} \exp(-\lambda Y_i^k). $$

Thus an event adds one factor of \(\lambda\), while both an event and a censoring time contribute an exponential term involving \(Y_i^k\). For \(n\) conditionally independent participants, define \(d=\sum_{i=1}^n\delta_i\), the number of observed events, and \(W=\sum_{i=1}^nY_i^k\), the total transformed follow-up. The likelihood, viewed as a function of \(\lambda\), is proportional to

$$ L(\lambda\mid\boldsymbol{Y},\boldsymbol{\delta},k) \propto \lambda^d\exp(-\lambda W). $$

The omitted factor is \(\prod_{i:\delta_i=1} kY_i^{k-1}\), which does not depend on \(\lambda\) when \(k\) is fixed. It can be omitted for inference about \(\lambda\). Censoring times must still be included in \(W\); treating them as if they were event times would add an incorrect density factor.

Gamma Prior and Posterior Update

Use the shape-rate parameterization of the Gamma distribution: \(\lambda\sim\operatorname{Gamma}(a,b)\) has density proportional to \(\lambda^{a-1}\exp(-b\lambda)\), for \(a,b>0\). Its mean is \(a/b\). Because \(\lambda\) has units of time\(^{-k}\), the prior rate \(b\) has units of time\(^{k}\), matching \(W\).

Theorem: Under the fixed-shape Weibull model, with conditionally independent event times and a \(\operatorname{Gamma}(a,b)\) prior for \(\lambda\), the posterior distribution is $$ \lambda\mid\boldsymbol{Y},\boldsymbol{\delta},k \sim \operatorname{Gamma}(a+d,\ b+W). $$ This update assumes the censoring mechanism is non-informative for the event-time likelihood—for example, censoring is independent of event time under the model, or is administrative and independent of the event process. If censoring depends on an unmodeled event risk, this likelihood need not be adequate.

The conjugate update follows directly by multiplying prior and likelihood. The prior density contributes \(\lambda^{a-1}\exp(-b\lambda)\), while the likelihood contributes \(\lambda^d\exp(-W\lambda)\). Their product is proportional to

$$ \lambda^{a+d-1}\exp[-(b+W)\lambda], $$

which is the kernel of a Gamma distribution with shape \(a+d\) and rate \(b+W\). This also shows why censored participants add to the posterior rate but not to the posterior shape: their follow-up contributes to \(W\), but they do not add an observed event.

Worked Example: Separating Event and Censoring Contributions

Suppose, hypothetically, three trial participants have follow-up times of 1, 2, and 3 days. Events are observed at days 1 and 2; the participant followed for 3 days is right-censored. Take the Weibull shape to be fixed at \(k=2\). Write the likelihood as a function of \(\lambda\).

For an event at time \(t\), the density is \(2\lambda t\exp(-\lambda t^2)\). The event at day 1 contributes \(2\lambda\exp(-\lambda)\); the event at day 2 contributes \(4\lambda\exp(-4\lambda)\). The censoring at day 3 contributes survival, \(\exp(-9\lambda)\), not a density.

Multiplying these contributions gives $$ L(\lambda)=(2\lambda e^{-\lambda})(4\lambda e^{-4\lambda})(e^{-9\lambda}) =8\lambda^2e^{-14\lambda}. $$ Thus \(d=2\) and \(W=1^2+2^2+3^2=14\) days squared. The factor 8 is independent of \(\lambda\), so the likelihood kernel is \(\lambda^2e^{-14\lambda}\).

The event times contribute their density terms, and the censored participant contributes only the probability of remaining event-free through day 3. This is why the censored time appears in \(W\), although it does not increase \(d\).

Worked Example: Updating the Rate and Calculating Survival

For the hypothetical data above, suppose the prior is \(\lambda\sim\operatorname{Gamma}(2,10)\), with the prior rate measured in days squared. Find the posterior and the posterior mean survival probability at 2 days.

Here \(d=2\) and \(W=14\) days squared. The update gives $$ \lambda\mid\text{data}\sim\operatorname{Gamma}(2+2,10+14) =\operatorname{Gamma}(4,24). $$ The posterior mean of \(\lambda\) is \(4/24=0.1667\) per day squared.

At \(t=2\) days, conditional survival is \(S(2\mid\lambda,2)=\exp(-4\lambda)\). The posterior mean survival averages that probability over the posterior distribution of \(\lambda\). For a Gamma shape-rate variable, integrating its density gives $$ E[\exp(-c\lambda)\mid\text{data}] =\left(\frac{r}{r+c}\right)^\alpha, $$ when the posterior is \(\operatorname{Gamma}(\alpha,r)\) and \(c\geq0\). Here \(\alpha=4\), \(r=24\), and \(c=4\), so $$ E[S(2\mid\lambda,2)\mid\text{data}] =\left(\frac{24}{24+4}\right)^4 =\left(\frac{6}{7}\right)^4 =\frac{1296}{2401} \approx 0.5398. $$ The posterior mean survival probability at 2 days is therefore about 0.5398.

This is not the same as substituting the posterior mean rate into the survival function. That plug-in value is \(\exp[-4(4/24)]=\exp(-2/3)\approx0.5134\). Averaging a nonlinear function over a posterior distribution generally differs from evaluating it at the posterior mean.

Posterior Survival Probabilities and a Justification

For any fixed time \(t\), the posterior distribution for survival is obtained by transforming the posterior for \(\lambda\): \(S(t)=\exp(-\lambda t^k)\). A useful summary is the posterior mean survival probability. If \(\lambda\mid\text{data}\sim\operatorname{Gamma}(\alpha,r)\), then

$$ E[S(t)\mid\text{data}] =E[\exp(-\lambda t^k)\mid\text{data}] =\left(\frac{r}{r+t^k}\right)^\alpha. $$

To justify the integration, the Gamma density is \(r^\alpha\lambda^{\alpha-1}\exp(-r\lambda)/\Gamma(\alpha)\). Multiplication by \(\exp(-\lambda t^k)\) changes the exponential rate from \(r\) to \(r+t^k\). The integral of \(\lambda^{\alpha-1}\exp[-(r+t^k)\lambda]\) over positive \(\lambda\) is \(\Gamma(\alpha)/(r+t^k)^\alpha\). Multiplying by the density constant yields the stated expression.

Posterior probabilities about survival can also be calculated by transforming the event of interest. Since \(S(t)=\exp(-\lambda t^k)\) decreases as \(\lambda\) increases, for \(0<s_0<1\),

$$ P\{S(t)>s_0\mid\text{data}\} =P\left\{\lambda<\frac{-\log(s_0)}{t^k}\,\middle|\,\text{data}\right\}. $$

The right-hand side is a Gamma posterior probability. It can be evaluated with the Gamma cumulative distribution function. This transformation also provides posterior quantiles for survival: a lower rate corresponds to a higher survival probability, so the ordering reverses when converting rate quantiles to survival quantiles.

Worked Example: Probability Survival Exceeds One Half

Continue with the posterior \(\lambda\mid\text{data}\sim\operatorname{Gamma}(4,24)\) and \(k=2\). Find the posterior probability that survival at 2 days exceeds 0.5.

The condition \(\exp(-4\lambda)>0.5\) is equivalent to $$ \lambda<\frac{-\log(0.5)}{4} =\frac{\log(2)}{4} \approx0.1733\ \text{days}^{-2}. $$ After scaling a Gamma variable by its rate, \(24\lambda\) has a Gamma distribution with shape 4 and rate 1. Therefore the probability is the shape-4, rate-1 Gamma cumulative probability at $$ 24\left(\frac{\log(2)}{4}\right)=6\log(2)\approx4.159. $$ For an integer shape of 4, that cumulative probability is \(1-e^{-z}(1+z+z^2/2+z^3/6)\). With \(z=6\log(2)\), \(e^{-z}=1/64\), giving $$ 1-\frac{1}{64}\left(1+4.1589+\frac{4.1589^2}{2}+\frac{4.1589^3}{6}\right) \approx0.5969. $$ Under this model and prior, the posterior probability that more than half of participants survive beyond 2 days is approximately 0.5969. It is a probability about the survival quantity under the posterior, not a probability that a null hypothesis is true.

Assumptions, Diagnostics, and Alternatives

The calculations rely on several assumptions. The observed event times are modeled by a common Weibull distribution with the same fixed \(k\) and unknown \(\lambda\); participants are conditionally independent given the model; and censoring is non-informative for the event-time likelihood. The Gamma prior must have support on positive rates. If participants have different treatment groups, covariates, or baseline risks, a single common rate may not represent the trial structure.

Diagnostics should assess whether the assumed time pattern is plausible, not merely whether the posterior update was computed correctly. With fixed \(k\), the hazard has the form \(k\lambda t^{k-1}\): it increases when \(k>1\), decreases when \(k<1\), and is constant when \(k=1\). Compare this implied pattern with the observed event and censoring times and with suitable graphical summaries. Check whether conclusions change materially over scientifically plausible fixed values of \(k\). Such a sensitivity check does not make \(k\) estimated; it reveals how much the inference depends on treating it as known.

If the hazard pattern is inconsistent with a single fixed shape, the posterior can still be calculated but may give misleading survival summaries. Informative censoring is another failure mode: participants censored because their unobserved event risk differs systematically from that of those remaining under observation cannot generally be handled by simply multiplying by survival contributions. The censoring process may then require explicit modeling.

The exponential model is the special case \(k=1\), so it is simpler but restricts the hazard to be constant. The fixed-shape Weibull model allows a monotone changing hazard while retaining a one-parameter Gamma update. More flexible survival models can represent patterns that are not adequately captured by a single Weibull shape; flexibility comes with additional modeling choices and does not automatically eliminate the need for diagnostics. The introductory material on right-censored trial survival data provides the basic censoring setup; here the key additional feature is the Weibull transformation \(Y_i^k\).

Common mistake: A censored participant has not had an observed event, but that does not mean the participant contributes no information. The correct contribution is \(S(Y_i)\), so their follow-up increases \(W=\sum_iY_i^k\). Conversely, treating their censoring time as an event would incorrectly increase \(d\) and introduce a density factor.

Another common mistake is to interpret the posterior mean survival as the survival function evaluated at the posterior mean rate. These are different calculations: \(E[\exp(-\lambda t^k)\mid\text{data}]\) averages over uncertainty in \(\lambda\), whereas \(\exp[-E(\lambda\mid\text{data})t^k]\) plugs in a single rate. Report which summary is being used and give the time units.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. With fixed \(k=1.5\), what does one right-censored observation at time \(c\) contribute to the likelihood as a function of \(\lambda\)?
  2. Suppose \(d=3\), \(W=12\) time-units\(^{k}\), and the prior is \(\operatorname{Gamma}(2,5)\). State the posterior distribution.
  3. For that posterior, calculate the posterior mean survival at a time \(t\) satisfying \(t^k=3\).
  4. Explain why an observed event changes the posterior shape while a censored follow-up time changes the posterior rate.

Solutions. (1) The contribution is \(S(c)=\exp(-\lambda c^{1.5})\), because the event has not been observed by \(c\). (2) The posterior is \(\operatorname{Gamma}(2+3,5+12)=\operatorname{Gamma}(5,17)\). (3) Use \((r/(r+t^k))^\alpha\): \((17/(17+3))^5=(17/20)^5=0.4437\), approximately. (4) Each observed event contributes one factor of \(\lambda\), adding one to the power of \(\lambda\) in the likelihood and hence to the Gamma shape. Every participant’s observed follow-up contributes \(\exp(-\lambda Y_i^k)\), increasing the likelihood’s rate term; for a censored participant this is the only \(\lambda\)-dependent contribution.

Clinical Biostats