Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Survival and mean survival from a bathtub-shaped hazard

S(t) = exp(-H(t)), H(t) = integral_0^t h(u) du; E_T = integral_0^inf S(t) dt

Maps a hazard that is high soon after a procedure, falls to a stable level and later rises with age to the survival curve and the mean survival that a health economic model needs. Survival at time t is the exponential of minus the cumulative hazard up to t, and mean survival is the area under the survival curve. The formulae below apply this to a piecewise-constant hazard schedule, to a constant hazard fitted to early follow-up, to a sum of two Weibull hazards and to an all-cause hazard built from background and excess components. Turning an interval hazard into a cycle transition probability uses the conversion already given on the Transition Probability page (HE-FM-TP-001), which is not repeated here.

  • Survival and life-years in one interval of a piecewise bathtub hazard

    S_j = S_prev * exp(-h_j * L_j); A_j = S_prev * (1 - exp(-h_j * L_j)) / h_j

    For an interval of length L_j with constant hazard h_j, survival at the end of the interval is survival at its start multiplied by exp(-h_j L_j), and the expected life-years lived in the interval per person entering the cohort are the area under the survival curve across the interval. Chaining intervals with a high early hazard, a low middle hazard and higher late hazards reproduces a bathtub shape exactly, without fitting a single distribution. The function exp is the exponential function.

  • Mean survival under a bathtub hazard with an open final interval

    E_T = A_closed + S_c / h_K

    Adds the life-years from the closed intervals to the life-years in the open final interval, where a constant hazard h_K applies for ever. The open interval contributes survival at the last cut point divided by h_K, the area under an exponential tail. The result is the undiscounted mean survival per person entering the cohort.

  • Constant hazard fitted to early follow-up of a bathtub-hazard cohort

    lambda_hat = D / PY; S_t = exp(-lambda_hat * t); E_T = 1 / lambda_hat

    Fits an exponential model to follow-up that covers only the early part of a bathtub hazard. The fitted hazard is the deaths divided by the person-years at risk, the rate formula of the Adverse Event Rate page (HE-FM-AER-002), and the exponential model then implies survival exp(-lambda_hat t) and mean survival 1 divided by lambda_hat. Comparing these with the bathtub values shows how a constant hazard misplaces deaths and overstates the tail.

  • Bathtub hazard as the sum of two Weibull hazards

    h_t = lambda_1 * gamma_1 * t^(gamma_1 - 1) + lambda_2 * gamma_2 * t^(gamma_2 - 1); S_t = exp(-(lambda_1 * t^gamma_1 + lambda_2 * t^gamma_2))

    The poly-Weibull model of Demiris, Lunn and Sharples adds a falling Weibull hazard, with shape gamma_1 below 1, to a rising one, with shape gamma_2 above 1, so the total hazard falls at first and rises later. Survival is the exponential of minus the summed Weibull cumulative hazards, which is the product of the two component survival curves. The symbol ^ denotes a power.

  • All-cause bathtub hazard as background plus excess hazard

    h_all = h_bg + h_exc

    Splits the all-cause hazard into a background hazard from population mortality and an excess hazard attributed to the disease or procedure. When the excess hazard declines after the early period, the background hazard, which rises with age, supplies the late arm of the bathtub. On the survival scale the same relation makes all-cause survival equal to background survival multiplied by relative survival. The per-cycle probability follows from h_all with the conversion HE-FM-TP-001.