Skip to contents

Obtain the cumulative hazard at a particular time, given a data frame of piecewise-constant background hazards. This is used in the computation of likelihoods and results in additive hazards models.


get_cum_backhaz(t, backhaz, strata = NULL)



A time point, or vector of time points, to calculate the cumulative hazard at.


A data frame with two columns, named "time" and "hazard". Each row gives the "background" hazard between the specified time and the next time.


A vector of the same length as t indicating strata. There should then be

  • a column in backhaz named stratum, which should be a factor with the same levels as strata (or analogous character vector).

  • a row in backhaz indicating the background hazard at each time interval for each stratum in strata.

We assume that the background hazard is known at all times, and defined by a piecewise-constant function (step function) of time. The first element of "time" should be 0, and the final row specifies the hazard at all times greater than the last element of "time".

In additive hazards models, the background hazard is the hazard of death from causes other than the specific cause of interest. The overall hazard is defined as the sum of the background hazard and the cause-specific hazard. In survextrap, the cause-specific hazard is modelled with the M-spline model, and the background hazard is assumed to be known.


The cumulative hazard at t.