Why Smooth the Baseline Hazard?
A baseline hazard describes how the event rate changes over time for a subject at the reference covariate and association values. A Weibull baseline imposes a particular global shape; a piecewise-exponential baseline allows changes between intervals but can create abrupt jumps at their boundaries. A spline offers a flexible middle ground: its log hazard is assembled from smooth basis functions, while a prior discourages implausibly rapid changes.
In a Bayesian joint model, this baseline is combined with the longitudinal process and the survival contribution. The spline prior concerns the shape of the baseline log hazard; it does not replace the model for the longitudinal measurements or the association between the longitudinal trajectory and event risk. The key modeling choice is how strongly to regularize changes in the spline coefficients.
The knots, spline degree, and basis are fixed before fitting or otherwise specified as part of the model. They determine the functions available to describe the curve. The coefficient prior then regulates how the curve uses that flexibility. With a B-spline basis, the basis functions are local: changing one coefficient primarily affects a portion of the time range. The coefficients are not generally log hazards at individual observed times.
The Joint-Model Likelihood Contribution
For clarity, consider a shared-parameter survival model with subject-specific random effects \(b_i\), observed event or censoring time \(T_i\), and event indicator \(\delta_i\), where \(\delta_i=1\) denotes an observed event and \(\delta_i=0\) denotes right censoring. One common conditional hazard is
Here \(\mathbf{x}_i\) is a vector of survival covariates, \(\boldsymbol{\beta}\) their coefficients, \(m_i(t)\) the subject-specific longitudinal trajectory evaluated at time \(t\), and \(\alpha\) the association parameter. Conditional on the random effects and model parameters, subject \(i\)'s survival likelihood contribution is
The spline enters both the event hazard and the integrated hazard. For a censored subject, the event-hazard factor is absent, but the survival through \(T_i\) still contributes through the integral. The joint likelihood also includes the longitudinal measurement model, and inference integrates or samples over the random effects as appropriate. This tutorial focuses on the prior that regularizes \(\boldsymbol{\gamma}\).
A Second-Difference Smoothing Prior
A standard choice penalizes second differences of adjacent coefficients. A small second difference means that successive coefficient increments are similar; this tends to favor a gently changing coefficient sequence rather than abrupt curvature. For \(k=3,\ldots,K\), define \(\Delta^2\gamma_k=\gamma_k-2\gamma_{k-1}+\gamma_{k-2}\).
The proper priors on the first two coefficients matter. The second-difference terms alone do not penalize a sequence with zero second differences: any sequence \(\gamma_k=a+b(k-1)\) has \(\Delta^2\gamma_k=0\). Thus the second-difference prior by itself is an intrinsic, improper prior on the full coefficient vector. Proper level and slope priors, or an explicitly justified alternative constraint and prior, are needed for a proper specification. A common choice is \(\gamma_1\sim N(m_1,v_1)\) and \(\gamma_2\sim N(m_2,v_2)\), independently, with finite \(v_1,v_2>0\).
A hyperprior can be assigned to \(\tau\), for example a Gamma distribution specified by shape and rate, or \(\tau\) can be fixed. A hyperprior allows the data to inform smoothness, but it does not make the prior irrelevant: its scale and the coefficient units still influence the range of smoothing supported by the model.
Why the Prior Is a Roughness Penalty
The prior's effect can be seen directly by taking its logarithm. Ignoring terms that do not depend on \(\boldsymbol{\gamma}\), the second-difference contribution to the log posterior is
The survival likelihood rewards coefficient patterns that fit the observed event and censoring times. The prior subtracts a cost for curvature in the coefficient sequence. The posterior therefore balances fit against roughness; it is not obtained by smoothing the data independently of the likelihood.
Compute \(d_k=\gamma_k-\gamma_{k-1}\) for each adjacent pair.
The second difference is \(d_k-d_{k-1}=\Delta^2\gamma_k\). A zero value means the coefficient sequence is locally linear in its index.
Each squared second difference adds to the roughness sum, which is multiplied by \(\tau/2\) in the negative log prior.
This is a coefficient-space penalty. It encourages a smooth baseline curve for common spline bases, but it is not exactly the integrated squared second derivative of \(\log h_0(t)\) in every basis or knot configuration. Knot placement, basis scaling, and boundary behavior therefore remain important parts of the specification.
Worked Example: Computing a Baseline Hazard at One Time
Suppose time is measured in months and, at month 6, the fixed spline basis has values \(\mathbf{B}(6)=(0.1,0.6,0.3)\). Take hypothetical coefficients \(\boldsymbol{\gamma}=(-3,-2,-1)\). For a subject with \(\mathbf{x}_i^\mathsf{T}\boldsymbol{\beta}=0.2\), \(m_i(6)=0.5\), and \(\alpha=0.4\), calculate the baseline and subject-specific hazard at that time.
The baseline log hazard is $$ \mathbf{B}(6)^\mathsf{T}\boldsymbol{\gamma} =(0.1)(-3)+(0.6)(-2)+(0.3)(-1)=-0.3-1.2-0.3=-1.8. $$
Thus the baseline hazard is \(h_0(6)=\exp(-1.8)=0.1653\) per month. The subject-specific linear predictor added to the baseline is \(0.2+(0.4)(0.5)=0.4\), so $$ h_i(6\mid b_i)=0.1653\exp(0.4)=0.1653(1.4918)=0.2466 $$ per month. This is the instantaneous conditional event rate at month 6 under the stated hypothetical parameter values, not the probability of an event during the month.
Worked Example: Evaluating the Smoothing Penalty
Take four hypothetical coefficients \(\boldsymbol{\gamma}=(-3,-2,-1.5,-1)\). The second differences are \(\Delta^2\gamma_3=-1.5-2(-2)+(-3)=-0.5\) and \(\Delta^2\gamma_4=-1-2(-1.5)+(-2)=0\). The total squared roughness is therefore \(0.5^2+0^2=0.25\).
Ignoring the same normalizing factors and the priors on the first two coefficients, the log-prior penalty is \(-\tau(0.25)/2\). At \(\tau=4\), this is \(-0.5\); at \(\tau=16\), it is \(-2\). Consequently, this coefficient pattern receives less prior weight relative to a zero-second-difference pattern when the precision is larger. The comparison concerns the curvature penalty only; the full prior density also depends on its normalization and on the proper priors for the initial coefficients.
For an individual second difference, the prior standard deviation is \(\tau^{-1/2}\). It is \(0.5\) at \(\tau=4\) and \(0.25\) at \(\tau=16\). Under the stated normal prior, the probabilities that its absolute value is below \(0.5\) are approximately \(0.683\) and \(0.954\), respectively. These are prior probabilities for a coefficient difference, not posterior probabilities for a particular fitted curve.
Worked Example: Event Contribution Under the Spline Hazard
Continue with the hypothetical subject-specific hazard \(h_i(6\mid b_i)=0.2466\) per month. Suppose the subject has an observed event at month 6 and, after integrating the fitted hazard over months 0 through 6, the cumulative hazard is \(0.80\). The survival likelihood contribution is $$ L_{Si}=h_i(6\mid b_i)\exp(-0.80) =(0.2466)(0.4493)=0.1108 $$ per month.
The density contribution has inverse-month units because an event time is continuous; the survival probability \(\exp(-0.80)=0.4493\) is dimensionless. The cumulative hazard value \(0.80\) is hypothetical and is not obtained from the single hazard value at month 6: it requires integrating the subject-specific hazard over the whole interval. If the observation were right-censored at month 6, its contribution would instead be \(\exp(-0.80)\), with no factor \(h_i(6\mid b_i)\).
Interpreting Precision and Checking the Fit
Increasing \(\tau\) narrows the prior distribution of each second difference and increases the roughness penalty. In the limit of very large \(\tau\), the coefficients are driven toward a linear sequence in their index, subject to the likelihood and the remaining priors. At finite \(\tau\), the posterior reflects both the likelihood and the smoothing prior. It is accurate to say that higher precision favors smoother coefficient sequences; it is not generally correct to promise that every posterior feature of the hazard curve changes monotonically as \(\tau\) increases.
Useful checks include plotting posterior baseline hazard curves over the observed follow-up range, inspecting behavior near boundaries, and comparing prior and posterior draws of the curve. These checks can reveal implausible oscillations, near-flat curves imposed by excessive smoothing, or unstable behavior where event information is limited. Check that the time units and knot locations are sensible, and examine whether the implied hazards and cumulative hazards are plausible across the follow-up interval. A prior predictive check can help show what curve shapes the chosen coefficient priors and precision make plausible before conditioning on the observed data.
A key limitation is that \(\tau\) is not directly comparable across arbitrary basis choices. Changing the number or spacing of knots, the spline degree, or coefficient scaling can change how coefficient differences correspond to curve roughness. Boundary behavior is another concern: there may be less information near the ends of follow-up, and the spline's edge shape can be sensitive to the basis and prior. Report the basis, knot specification, and prior on both the smoothing precision and the unpenalized components.
How This Baseline Compares with Alternatives
| Baseline approach | Shape flexibility | Main trade-off |
|---|---|---|
| Weibull baseline | One global parametric shape | Compact and interpretable, but can be too restrictive if the time pattern differs from the Weibull form. |
| Piecewise-exponential baseline | Separate constant hazards over specified intervals | Flexible across intervals, but the hazard can jump at cut points and results depend on interval choices. |
| Spline with smoothing prior | Flexible, smoothly varying log hazard | Can represent gradual shape changes, but requires choices about basis, knots, and smoothing prior. |
These are alternatives for representing \(h_0(t)\), not alternatives to specifying the longitudinal-survival association. A spline prior also cannot create event-time information that the data do not contain: where observations provide little information, the posterior curve may remain strongly influenced by its prior and basis.
Common Mistakes
- Confusing precision with variance. The second-difference variance is \(\tau^{-1}\), so larger \(\tau\) means stronger smoothing, not weaker smoothing.
- Using only second-difference terms and calling the prior proper. Linear coefficient sequences have zero penalty. Specify proper priors for the level and slope, or a justified alternative that makes the full prior proper.
- Interpreting coefficients as hazard values. A coefficient is a weight on a basis function; the log hazard at time \(t\) is the weighted sum of all basis values at \(t\).
- Treating a hazard as an event probability. A hazard is an instantaneous rate. Event probabilities over intervals depend on the cumulative hazard over those intervals.
- Assuming a large number of knots guarantees a good fit. More basis functions increase flexibility and can make regularization and prior sensitivity more consequential.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- If \(\tau\) increases from 9 to 25, what happens to the prior standard deviation of a second difference?
- Why are proper priors or constraints needed beyond a second-difference penalty?
- For coefficients \((-2,-1,-1)\), calculate the second differences and the total squared roughness.
- Why does a right-censored subject still contribute information about the spline baseline?
Solutions. (1) The standard deviation changes from \(1/\sqrt{9}=1/3\) to \(1/\sqrt{25}=1/5\), so the prior concentrates more strongly near zero second differences. (2) Any coefficient sequence linear in its index has all second differences equal to zero; the penalty does not control its level or slope, so the full coefficient prior would otherwise be improper. (3) There is one second difference: \(-1-2(-1)+(-2)=-1\), so the total squared roughness is \(1\). (4) Censoring establishes that the subject remained event-free through the censoring time, contributing the survival term \(\exp\{-\int_0^{T_i}h_i(u\mid b_i)\,du\}\), which depends on the baseline curve over that interval.