Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Weibull Baseline Hazards in Bayesian Joint Models

Bayesian Joint Models · Tutorial 312 of 697

Weibull Baseline Hazards in Bayesian Joint Models

Learn how Weibull scale and shape priors enter a joint posterior and how posterior draws translate into baseline survival and hazard.

Advanced 11 min read

What You'll Learn

  • Parameterize the Weibull baseline hazard using a time-scale parameter and a dimensionless shape parameter.
  • Derive the event and censoring contributions to the joint posterior.
  • Specify priors on the Weibull scale and shape and account for their transformations.
  • Interpret posterior draws as baseline hazards and survival probabilities at chosen times.
  • Recognize assumptions, numerical issues, and limitations of a Weibull baseline.

Why Model the Baseline Hazard Parametrically?

In a joint model, the event process is linked to a subject’s longitudinal trajectory, often through shared random effects or a time-varying measure of the biomarker. The baseline hazard supplies the event-time pattern before that association term is applied. A Weibull baseline is useful when a smooth, two-parameter hazard pattern is a reasonable working model and a compact posterior representation is desirable.

This tutorial uses \(T_i\) for subject \(i\)'s observed event or censoring time, \(\delta_i\) for the event indicator (\(\delta_i=1\) for an observed event and \(0\) for right censoring), and \(b_i\) for that subject's random effects. Write the hazard multiplier associated with the longitudinal and covariate information as \(\exp\{\eta_i(t)\}\). Conditional on \(b_i\) and model parameters, the subject-specific hazard is \(h_0(t)\exp\{\eta_i(t)\}\). Thus \(h_0(t)\) is the baseline hazard for \(\eta_i(t)=0\), not generally the hazard of a typical subject.

Definition: In the scale–shape parameterization used here, the Weibull baseline survival function, cumulative hazard, and hazard are $$ S_0(t)=\exp\left[-\left(\frac{t}{\lambda}\right)^\kappa\right],\qquad H_0(t)=\left(\frac{t}{\lambda}\right)^\kappa,\qquad h_0(t)=\frac{\kappa}{\lambda}\left(\frac{t}{\lambda}\right)^{\kappa-1}, $$ for \(t>0\), scale \(\lambda>0\), and shape \(\kappa>0\). The scale \(\lambda\) has the same time units as \(t\); the shape \(\kappa\) is dimensionless. At \(t=\lambda\), \(S_0(t)=e^{-1}\), and the baseline cumulative hazard equals 1.

The shape controls how the baseline hazard changes over time: it decreases when \(\kappa<1\), is constant when \(\kappa=1\), and increases when \(\kappa>1\). These statements concern the baseline hazard, holding the other model terms fixed. The Weibull form is not flexible enough to represent an arbitrary sequence of increases and decreases.

Worked Example: Reading Scale and Shape in Context

Suppose, hypothetically, that follow-up time is measured in months and a posterior draw is \(\lambda=12\) months and \(\kappa=1.5\). At the baseline covariate level, the survival probability at 12 months is $$ S_0(12)=\exp\left[-\left(\frac{12}{12}\right)^{1.5}\right]=e^{-1}=0.3679. $$

The baseline hazard at 12 months is $$ h_0(12)=\frac{1.5}{12}\left(\frac{12}{12}\right)^{0.5} =0.125\ \text{per month}. $$ Because \(\kappa=1.5>1\), the baseline hazard increases with time. The scale is not the median event time: here it marks the time by which baseline cumulative hazard is 1, corresponding to baseline survival \(0.3679\).

Right-Censored Likelihood Contribution

Assume a continuous event time, conditionally independent subjects, and right censoring that is noninformative conditional on the information included in the model. The event-time likelihood contribution is the event density when \(\delta_i=1\), and the survival probability through \(T_i\) when \(\delta_i=0\). Since a density can be written as hazard times survival, both cases can be written in one expression: $$ L_i^{(T)}=h_i(T_i)^{\delta_i}S_i(T_i) =h_i(T_i)^{\delta_i}\exp\{-H_i(T_i)\}. $$ Here \(h_i(t)=h_0(t)\exp\{\eta_i(t)\}\) and $$ H_i(T_i)=\int_0^{T_i}h_0(u)\exp\{\eta_i(u)\}\,du. $$ Taking logarithms and substituting the Weibull baseline gives $$ \ell_i^{(T)} =\delta_i\left[\log\kappa-\kappa\log\lambda +(\kappa-1)\log T_i+\eta_i(T_i)\right] -\frac{1}{\lambda^\kappa}\int_0^{T_i}\kappa u^{\kappa-1}\exp\{\eta_i(u)\}\,du. $$ The event term is present only for an observed event. The integrated hazard term is present for every subject, including those censored, because censoring still tells us the subject remained event-free up to \(T_i\).

Derivation: The conditional survival function obeys \(S_i(T_i)=\exp\{-H_i(T_i)\}\), and the event density is \(f_i(T_i)=h_i(T_i)S_i(T_i)\). Therefore \(f_i(T_i)^{\delta_i}S_i(T_i)^{1-\delta_i}=h_i(T_i)^{\delta_i}S_i(T_i)\). Substituting \(h_i(T_i)=h_0(T_i)\exp\{\eta_i(T_i)\}\) and the integrated hazard above yields the stated log-likelihood contribution.

If \(\eta_i(t)\) is constant over time, the integrated hazard has a closed form: $$ H_i(T_i)=\exp\{\eta_i\}\left(\frac{T_i}{\lambda}\right)^\kappa. $$ When the association term depends on the evolving biomarker trajectory, the integral will generally depend on that trajectory and may require numerical integration. The conditional likelihood remains the same; only its evaluation changes.

Worked Example: Computing Event and Censoring Contributions

Consider hypothetical subjects with constant hazard multipliers. Let \(\lambda=10\) months and \(\kappa=1.5\). Subject A has an event at \(T_A=8\) months and \(\exp\{\eta_A\}=1.2\). Subject B is censored at \(T_B=6\) months and \(\exp\{\eta_B\}=0.8\). These assumed constant multipliers make the cumulative hazards directly calculable.

For subject A, the cumulative hazard is $$ H_A(8)=1.2\left(\frac{8}{10}\right)^{1.5} =1.2(0.7155)=0.8587. $$ The event hazard at 8 months is $$ h_A(8)=1.2\frac{1.5}{10}\left(\frac{8}{10}\right)^{0.5} =1.2(0.1342)=0.1610\ \text{per month}. $$ Thus the log-likelihood contribution is $$ \ell_A^{(T)}=\log(0.1610)-0.8587=-2.685 $$ (to rounding). The event contributes a hazard density as well as survival through month 8.

For subject B, the contribution has no event-hazard term. Its cumulative hazard is $$ H_B(6)=0.8\left(\frac{6}{10}\right)^{1.5} =0.8(0.4648)=0.3718, $$ so \(\ell_B^{(T)}=-0.3718\). The two-subject log-likelihood contribution is \(-2.685-0.3718=-3.057\), approximately. Omitting subject B because the event was not observed would discard the information that this subject remained event-free for 6 months.

Priors and the Joint Posterior

A common choice is to put normal priors on log scale and log shape: $$ \log\lambda\sim N(m_\lambda,s_\lambda^2),\qquad \log\kappa\sim N(m_\kappa,s_\kappa^2). $$ These priors ensure positive parameters. Their medians on the original scale are \(\exp(m_\lambda)\) and \(\exp(m_\kappa)\). Their spreads should be chosen in light of the follow-up time units and plausible hazard shapes; a prior that seems diffuse in one time unit can imply very different beliefs after rescaling time. Prior predictive checks can reveal whether the induced event times and hazard trajectories are plausible.

For clarity, let \(\theta\) denote all parameters other than \(\lambda,\kappa\), including longitudinal-model parameters, association parameters, and random effects. Conditional on the random effects and model parameters, and assuming the usual conditional factorization of longitudinal and event processes, the posterior kernel is $$ p(\theta,\lambda,\kappa,\mathbf b\mid \mathbf y,\mathbf T,\boldsymbol\delta) \propto \left[\prod_i p(y_i\mid b_i,\theta)\right] \left[\prod_i h_i(T_i)^{\delta_i}\exp\{-H_i(T_i)\}\right] p(\mathbf b\mid\theta)\,p(\theta)\,p(\lambda)\,p(\kappa). $$ The Weibull parameters enter both the event-hazard terms for observed events and every subject's integrated hazard. They do not replace or remove the longitudinal likelihood or the random-effects distribution.

With normal priors on \(\log\lambda\) and \(\log\kappa\), the prior density with respect to \((\lambda,\kappa)\) includes the change-of-variables factor \(1/(\lambda\kappa)\). Equivalently, if computation is performed in coordinates \((\log\lambda,\log\kappa)\), the prior is directly normal in those coordinates. A sampler's target density must match the coordinates and density convention being used; omitting or duplicating the Jacobian changes the posterior.

Worked Example: Adding Priors to the Event Likelihood

Return to the two hypothetical subjects in the preceding example. Suppose the priors are \(\log\lambda\sim N(\log 10,0.25^2)\) and \(\log\kappa\sim N(\log 1.5,0.20^2)\), independently. At the candidate values \(\lambda=10\) months and \(\kappa=1.5\), both log parameters are at their prior means. Ignoring constants common to all candidate parameter values, their normal log-prior contributions in log coordinates are therefore zero.

The event-data log-likelihood contribution was approximately \(-3.057\). Hence the log posterior kernel contribution from these survival data and the two priors, with other model terms held fixed, is \(-3.057+0+0=-3.057\), up to constants independent of the candidate values. This is not the full joint posterior: the longitudinal likelihood, random-effects prior, and other parameter priors must also be included. The example shows precisely where the Weibull event likelihood and its priors enter.

Interpreting Posterior Draws

A posterior draw \((\lambda^{(m)},\kappa^{(m)})\) defines a complete baseline survival curve and hazard curve. Transform each draw before summarizing quantities such as survival at a clinically relevant time. For example, compute \(S_0(t)^{(m)}=\exp[-(t/\lambda^{(m)})^{\kappa^{(m)}}]\) for every draw, then summarize those values. A posterior interval for \(S_0(t)\) is generally not obtained by inserting separate marginal interval endpoints for \(\lambda\) and \(\kappa\), because their posterior dependence matters.

Worked Example: Translating Draws Into Survival Probabilities

Suppose a hypothetical MCMC output contains the following five illustrative draws. They are shown only to demonstrate transformation, not as a basis for a reliable posterior interval.

Draw\(\lambda\) (months)\(\kappa\)\(H_0(10)\)\(S_0(10)\)
181.2\((10/8)^{1.2}=1.307\)\(e^{-1.307}=0.271\)
291.4\((10/9)^{1.4}=1.159\)\(e^{-1.159}=0.314\)
3101.6\((10/10)^{1.6}=1.000\)\(e^{-1}=0.368\)
4121.8\((10/12)^{1.8}=0.720\)\(e^{-0.720}=0.487\)
5152.0\((10/15)^2=0.444\)\(e^{-0.444}=0.641\)

For example, draw 4 implies baseline survival of about \(0.487\) at 10 months, meaning that the model assigns that survival probability at the baseline covariate level for that parameter draw. In real analysis, summaries and credible intervals should use a sufficiently large, well-diagnosed set of posterior draws. These are conditional baseline quantities; a subject-specific survival curve also incorporates the subject's covariates and longitudinal association term.

Assumptions, Diagnostics, and Alternatives

The parametric baseline assumes a Weibull-shaped hazard over the modeled follow-up interval. The shared-effects structure also requires that the chosen random effects and association term adequately represent how the longitudinal process relates to the event process. Conditional independence assumptions, the censoring mechanism, and the event-time scale must be defensible. In particular, if censoring is informative after conditioning on modeled variables, the likelihood above does not account for that additional dependence.

Check whether the model implies plausible survival and hazard curves over the observed and scientifically relevant time ranges, not just near the center of follow-up. Examine prior predictive curves and posterior draws; extreme values of \(\lambda\) or \(\kappa\) can produce nearly immediate events, very long survival, or sharply changing hazards. Also check that numerical integration of \(H_i(T_i)\) is accurate when \(\eta_i(t)\) varies over time. Integration error can distort the posterior target and its gradients.

A frequent mistake is to treat \(\lambda\) as a median survival time or to interpret the baseline hazard as the hazard for every subject. The correction is that \(S_0(\lambda)=e^{-1}\), not \(0.5\), and the subject-specific hazard includes the multiplier \(\exp\{\eta_i(t)\}\). Another mistake is to omit the integrated hazard for censored subjects; censoring removes the event-density term, not survival information through the censoring time.

A Weibull baseline is more restrictive than a piecewise exponential baseline, which allows a stepwise hazard across intervals, but it offers a smooth curve with only scale and shape parameters. A spline baseline can represent more varied hazard shapes, at the cost of additional parameters and smoothing choices. The appropriate alternative depends on event information, substantive expectations, and the need for flexibility; neither flexibility nor simplicity alone guarantees a well-fitting model.

Key takeaway: Specify the Weibull parameterization and time units explicitly, place priors on positive scale and shape parameters with the correct density transformation, and include the event hazard and cumulative hazard contributions for every subject. Interpret posterior draws through the survival or hazard quantities they imply.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. For \(\kappa=1\), what is the form of the baseline hazard, and how does \(\lambda\) relate to baseline survival?
  2. A subject is censored at time \(T\). Which part of the survival likelihood contribution is absent, and which part remains?
  3. With \(\lambda=20\) days and \(\kappa=2\), calculate baseline survival at 10 days.
  4. Why should survival probabilities be computed draw by draw rather than by combining separate marginal summaries of \(\lambda\) and \(\kappa\)?

Solutions. (1) The hazard is constant, \(h_0(t)=1/\lambda\); at \(t=\lambda\), baseline survival is \(e^{-1}=0.3679\). (2) The event-hazard factor \(h_i(T)^\delta\) is absent because \(\delta=0\), but \(\exp\{-H_i(T)\}\) remains. (3) \(S_0(10)=\exp[-(10/20)^2]=e^{-0.25}=0.7788\). (4) The transformation depends jointly and nonlinearly on both parameters, and their posterior dependence affects the resulting distribution of survival probabilities.

Clinical Biostats