Tutorials › Nonlinear Mixed-Effects Models (NLME) › Baseline Hazards in Mixed-Effects Survival Models

Categorical, Count and Time-to-Event Responses · Tutorial 442 of 797

Baseline Hazards in Mixed-Effects Survival Models

Learn how to specify and compare baseline hazard shapes, combine them with individual predictors, and calculate conditional survival from each model.

Advanced 12 min read

What You'll Learn

  • Define a baseline hazard relative to covariates and random effects.
  • Calculate cumulative hazards and survival under Weibull and log-linear baselines.
  • Build a piecewise-constant hazard and integrate across interval boundaries.
  • Use a log-hazard spline and numerical integration to obtain survival.
  • Compare baseline specifications and recognize their main failure modes.

Why the Baseline Hazard Matters

A survival model describes how the instantaneous event rate changes over time. In a nonlinear mixed-effects model (NLME), it must also allow the event rate to depend on subject-specific predictors and, when specified, individual random effects. The baseline hazard describes the time pattern for the reference individual; the rest of the model modifies that pattern. Choosing its shape matters because a poor baseline can distort fitted event rates even when the individual predictors are sensible.

This tutorial compares three ways to specify that time pattern: a parametric function, a piecewise-constant function, and a flexible spline. Each can be combined with the same individual-level predictor. The central calculation is the cumulative hazard: integrate the hazard over time, then convert that quantity to a survival probability.

Definition: Let \(T_i\) be the event time for subject \(i\), and let \(b_i\) denote that subject’s random effects. Conditional on \(b_i\) and covariates \(x_i\), the hazard at time \(t\) is \(h_i(t\mid b_i,x_i)=\lim_{\Delta t\to 0}P(t\leq T_i<t+\Delta t\mid T_i\geq t,b_i,x_i)/\Delta t\). The baseline hazard \(h_0(t)\) is the hazard for the reference covariate values and \(b_i=0\). Its cumulative hazard is \(H_0(t)=\int_0^t h_0(u)\,du\). Conditional survival is \(S_i(t\mid b_i,x_i)=\exp\{-\int_0^t h_i(u\mid b_i,x_i)\,du\}\).

A common NLME specification combines the baseline and an individual predictor multiplicatively:

$$ h_i(t\mid b_i,x_i)=h_0(t)\exp(\eta_i), \qquad \eta_i=x_i^\top\beta+z_i^\top b_i. $$

Here \(x_i\) and \(z_i\) are covariate vectors, \(\beta\) is a vector of fixed-effect coefficients, and \(b_i\) is a subject-specific random-effect vector. This specification makes the conditional cumulative hazard \(H_i(t\mid b_i,x_i)=\exp(\eta_i)H_0(t)\). The baseline’s units are inverse time; its integral is dimensionless. The model is conditional on \(b_i\); population-level predictions require accounting for the distribution of those random effects.

The usual likelihood setup for time-to-event data also needs an appropriate censoring model or a conditional independence assumption for censoring. The baseline choice does not remove that requirement. The likelihoods for time-to-event NLME data give the event and censoring contributions; here the focus is on the hazard shape used in those contributions.

Three Baseline-Hazard Specifications

A parametric baseline fixes a functional form with a small number of parameters. For example, a Weibull baseline with scale \(\lambda>0\) and shape \(\kappa>0\) is

$$ h_0(t)=\frac{\kappa}{\lambda}\left(\frac{t}{\lambda}\right)^{\kappa-1}, \qquad H_0(t)=\left(\frac{t}{\lambda}\right)^\kappa. $$

The scale \(\lambda\) has units of time, and \(\kappa\) is dimensionless. When \(\kappa=1\), the hazard is constant. For \(\kappa>1\), it increases with time; for \(0<\kappa<1\), it decreases. These shapes are convenient and cumulative hazards are available in closed form, but a chosen family may not represent the actual time pattern well.

A piecewise-constant baseline sets a separate hazard rate on each time interval. If the cut points are \(0=\tau_0<\tau_1<\cdots<\tau_J\) and the rate on interval \(j\) is \(q_j>0\), then \(h_0(t)=q_j\) for \(\tau_{j-1}\leq t<\tau_j\). Its cumulative hazard is the sum of each rate multiplied by the time spent in that interval. The hazard can jump at a cut point, so the cut points and number of intervals influence the fitted shape.

A spline baseline represents the log hazard using smooth basis functions:

$$ \log h_0(t)=\sum_{m=1}^{M}\gamma_m B_m(t). $$

The \(B_m(t)\) are specified basis functions, such as spline functions, and the \(\gamma_m\) are coefficients. Exponentiating guarantees a positive hazard. A spline can adapt to more varied time patterns than a simple parametric family, but it needs choices about basis, knots, and boundary behavior. Its cumulative hazard usually has to be calculated numerically.

Worked Example: A Weibull Baseline With an Individual Predictor

Suppose time is measured in days, \(\lambda=10\) days and \(\kappa=1.5\). For a hypothetical subject, let \(\eta_i=\log(0.70)\), so the individual multiplier is \(0.70\). Calculate the hazard and survival at day 8.

The Weibull baseline hazard is \(h_0(8)=(1.5/10)(8/10)^{0.5}=0.15\sqrt{0.8}=0.1342\) per day. The baseline cumulative hazard is \(H_0(8)=(8/10)^{1.5}=0.7155\).

The subject-specific hazard at day 8 is \(0.70(0.1342)=0.09394\) per day. The conditional cumulative hazard is \(0.70(0.7155)=0.5009\), so \(S_i(8\mid b_i,x_i)=\exp(-0.5009)=0.6060\).

Thus, under the stated model and for this hypothetical subject, the conditional probability of remaining event-free through day 8 is approximately 0.606. This calculation is conditional on the specified individual predictor; it is not a population-average survival probability.

Worked Example: Integrating a Piecewise-Constant Baseline

Consider a hypothetical baseline with hazard \(0.0800\) per day from day 0 to day 2, \(0.0300\) per day from day 2 to day 5, and \(0.0100\) per day after day 5. A subject has \(\eta_i=\log(1.5)\). Find the baseline and subject-specific cumulative hazards through day 4, the conditional survival then, and the subject-specific hazard at day 3.

Through day 4, two intervals contribute: \(H_0(4)=(0.0800)(2)+(0.0300)(4-2)=0.1600+0.0600=0.2200\). The interval after day 5 contributes nothing by day 4.

Since \(\exp(\eta_i)=1.5\), the individual cumulative hazard is \(H_i(4)=1.5(0.2200)=0.3300\). Therefore \(S_i(4)=\exp(-0.3300)=0.7189\). At day 3, the baseline rate is \(0.0300\) per day, so the subject-specific hazard is \(1.5(0.0300)=0.04500\) per day.

The cumulative hazard is continuous as time crosses an interval boundary, even though the hazard itself changes abruptly. In calculations that cross several cut points, add each interval’s rate multiplied by the portion of that interval elapsed.

Justifying the Cumulative-Hazard Calculation

The conversion from a hazard to survival follows from the definition of the hazard. For a continuous event time, conditional survival satisfies \(h_i(t)=-d\log S_i(t)/dt\). Integrating from 0 to \(t\), with \(S_i(0)=1\), gives the cumulative-hazard result:

1
Start with the hazard identity.
\(h_i(u)=-d\log S_i(u)/du\), conditional on the subject’s predictors and random effects.
2
Integrate over time.
\(\int_0^t h_i(u)\,du=-[\log S_i(t)-\log S_i(0)]\).
3
Use the initial condition.
Because \(S_i(0)=1\), \(\log S_i(0)=0\), so \(\log S_i(t)=-H_i(t)\).
4
Exponentiate.
\(S_i(t)=\exp\{-H_i(t)\}\), which is between 0 and 1 whenever the cumulative hazard is nonnegative.

With a multiplicative individual predictor, \(h_i(u)=h_0(u)\exp(\eta_i)\), and \(\eta_i\) is constant over time in this specification. Therefore \(H_i(t)=\int_0^t h_0(u)\exp(\eta_i)\,du=\exp(\eta_i)H_0(t)\). This equality is the reason baseline cumulative hazards can be computed once and then adjusted for each subject’s predictor.

Worked Example: A Log-Linear Hazard Over Two Time Segments

For a hypothetical event-time pattern, let \(k=\log(2)/5=0.1386\) per day and define the baseline hazard over days 0 to 7.5 as \(h_0(t)=0.0400\exp\{k(t-5)\}\) per day. This continuous log-linear hazard doubles over each five-day period. A subject has \(\eta_i=-0.50\). Calculate the cumulative hazard through day 7.5 and the conditional survival probability.

Integrating the baseline hazard from day 0 to day 5 gives \(0.0400\{\exp(0)-\exp(-5k)\}/k\). Since \(\exp(-5k)=1/2\), this is \(0.0400(0.5)/0.1386=0.1443\).

From day 5 through day 7.5, the integral is \(0.0400\{\exp(2.5k)-1\}/k\). Here \(\exp(2.5k)=\sqrt{2}\), so the segment contributes \(0.0400(\sqrt{2}-1)/0.1386=0.1195\). The total baseline cumulative hazard is \(0.1443+0.1195=0.2638\), using unrounded segment values for the sum.

The individual cumulative hazard is \(0.2638\exp(-0.50)=0.1600\), using the unrounded baseline total. Thus conditional survival through day 7.5 is \(\exp(-0.1600)=0.8521\). The result is approximate because the displayed values are rounded.

This example also illustrates why integration must follow the specified hazard, rather than multiplying a single rate by elapsed time when the rate changes continuously.

Using a Spline Baseline

A spline offers flexibility while retaining a positive hazard through a log-hazard formulation. To make the calculation concrete, consider a simple linear spline with a knot at day 2:

$$ \log h_0(t)=\log(0.0500)+0.100t-0.0500(t-2)_+, \qquad (a)_+=\max(a,0). $$

The hazard is expressed numerically in inverse days. This basis makes the log hazard rise at slope \(0.100\) per day before day 2 and at slope \(0.0500\) per day after day 2. The hazard remains continuous at the knot. It is a simple spline illustration; more elaborate spline bases can use additional knots and smoother changes in slope.

Worked Example: Approximate Survival Under a Spline Baseline

Use the spline above, a time interval from day 0 to day 4, and a hypothetical subject with \(\eta_i=\log(0.7408)\), approximately \(-0.3000\). Approximate the baseline cumulative hazard with Simpson’s rule using one-day spacing, then calculate conditional survival.

The baseline hazards at days 0, 1, 2, 3, and 4 are respectively \(0.05000\), \(0.05526\), \(0.06107\), \(0.06420\), and \(0.06749\) per day. For a spacing of one day, Simpson’s rule gives

$$ H_0(4)\approx \frac{1}{3}\{h_0(0)+h_0(4)+4[h_0(1)+h_0(3)]+2h_0(2)\}=0.2392. $$

The individual multiplier is \(\exp(\eta_i)=0.7408\), so \(H_i(4)\approx0.7408(0.2392)=0.1772\). Conditional survival is approximately \(\exp(-0.1772)=0.8376\).

This is a numerical approximation, not an exact integral. A practical implementation should verify accuracy by reducing the integration step or using an adaptive numerical integration method; the cumulative hazard should stabilize as the integration is refined.

Choosing a Baseline and Checking Its Behavior

SpecificationMain strengthMain limitationUseful check
ParametricFew parameters and often a closed-form cumulative hazardCan impose an incorrect time shapeCompare fitted and observed event-time patterns over time
Piecewise-constantSimple integration and local flexibilityHazard jumps and results depend on cut pointsInspect interval rates and sensitivity to reasonable cut points
SplineFlexible, smooth time pattern with positive hazard on the log scaleRequires basis, knot, boundary, and integration choicesCheck fitted shape, integration accuracy, and sensitivity to spline complexity

A parametric hazard is attractive when its shape is credible and parsimony matters. A piecewise-constant hazard is useful when a stepwise approximation is adequate and interval rates are easy to communicate. A spline is useful when the time pattern may be curved but a rigid parametric form is not justified. These are choices about the baseline shape; the individual predictor structure can be held fixed when comparing them.

Check that fitted hazards are positive, cumulative hazards are nondecreasing, and survival probabilities remain between 0 and 1. A numerical cumulative hazard that decreases with time signals an integration or implementation error. Very abrupt changes in a piecewise model can indicate overly narrow intervals or sparse information. A spline that oscillates sharply, especially near the time boundaries, may be too flexible for the available event-time information. A parametric curve that systematically misses the event pattern at early or late times suggests that its chosen shape is inadequate.

Baseline shape is not identified equally well at all times: regions with few subjects still at risk contain limited information about the hazard. Complex splines and many piecewise intervals can therefore produce unstable estimates, while a restrictive parametric form can conceal genuine deviations. No baseline specification solves misspecified random-effects distributions, inappropriate censoring assumptions, or unmodeled individual predictors. Sensitivity analysis across plausible baseline forms is one way to determine whether substantive conclusions depend heavily on this choice.

Common Mistakes

  • Confusing hazard and probability. A hazard such as \(0.0450\) per day is a rate, not a 4.5% probability of an event by day 3. Survival requires integrating the hazard and applying \(S(t)=\exp\{-H(t)\}\).
  • Using one rate across a piecewise model. If the interval changes before the evaluation time, sum the contributions from every elapsed interval.
  • Forgetting the individual multiplier. Under the stated specification, multiply both the hazard and cumulative hazard by \(\exp(\eta_i)\); do not add \(\eta_i\) to the cumulative hazard.
  • Treating a fitted baseline as assumption-free. Piecewise cut points and spline knots are modeling choices, and a parametric family imposes its own shape.
Key takeaway: Specify the baseline hazard \(h_0(t)\), combine it with the subject-specific predictor, integrate to obtain cumulative hazard, and then compute conditional survival as its negative exponential. Baseline flexibility should be balanced against stability and checked against the time pattern supported by the data.

Check Your Understanding

Answer each question, then compare your work with the solutions.

  1. A constant baseline hazard is \(0.0200\) per month. What are \(H_0(6)\) and baseline survival through 6 months?
  2. A piecewise baseline has rates \(0.0500\) per day for days 0–2 and \(0.0200\) per day for days 2–5. Find \(H_0(4)\).
  3. Why does exponentiating a spline for the log hazard guarantee a positive hazard?
  4. Give one advantage and one limitation of a spline baseline relative to a parametric baseline.

Solutions. (1) \(H_0(6)=0.0200(6)=0.1200\). Survival is \(\exp(-0.1200)=0.8869\). (2) \(H_0(4)=0.0500(2)+0.0200(4-2)=0.1000+0.0400=0.1400\). (3) The exponential of any finite real number is strictly positive, so \(h_0(t)=\exp\{\text{log }h_0(t)\}>0\). (4) A spline can represent more varied time patterns than a simple parametric form, but its fit and numerical integration depend on basis and knot choices and can be unstable when overly flexible.