Functions & Formulae

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

Life years gained as the area between two survival curves and the share observed within a trial

G(S_1, S_0, tau, T) = (dRMST, dLY_life, phi, dLY_beyond)

Maps the survival curves of an intervention and its comparator, a trial follow-up time tau and a model horizon T to the life years gained within follow-up, the life years gained over the horizon, the share of that gain lying within follow-up and the gain lying after it. The gain over a horizon is the area between the two curves, the integral of S_1(t) minus S_0(t), which Royston and Parmar give as the difference in restricted mean survival time between two arms. Existing records are cited and not restated. The area under one curve is the restricted mean survival time of HE-FM-ADMC-003 for a Kaplan-Meier step function, the interval area A_j of HE-FM-BTH-001 under a constant hazard and the trapezoid life years of HE-CF-PSM-001, so the undiscounted gain is the difference of two such areas. The discounted gain is the present value of a stream, HE-FM-DR-002, applied to the yearly gains; the article's step 3, with year 1 undiscounted, places the gain of year k at time k minus 1 (t starting at 0 in HE-FM-DR-002, the start-of-year timing of HE-FM-DISC-002), whereas HE-CF-PSM-001 discounts each interval at its midpoint. The share of a gain that discounting removes, 1 minus the discounted total over the undiscounted total, equals rise divided by (1 plus rise) for the level stream of HE-CF-DISC-001 (derived here), so it is not drafted either. The cost per life year gained is HE-FM-ICER-001 with life years as the effect, and the QALY gain when both arms live at one constant utility is that utility times the life years gained, the constant-utility case of HE-FM-QALY-001 and of HE-FM-PSM-003 with equal state utilities. Mean survival with a cure fraction is HE-FN-CRM-001, the expected cycles alive of a constant-risk cohort follow from HE-FM-ABS-001, and the share of one arm's mean survival that comes from an exponential tail is P_tail of HE-FM-ADMC-004. Discounted quality-adjusted life expectancy belongs to the QALY Shortfall concept. Notation follows the Life Years Gained article.

  • Share of the life years gained over the model horizon observed within trial follow-up

    dRMST = RMST_1 - RMST_0; dLY_life = LY_1 - LY_0; phi = dRMST / dLY_life; dLY_beyond = dLY_life - dRMST

    Takes the restricted mean survival times of the two arms at a follow-up time tau and their mean survival over the model horizon, and returns the within-trial gain, the gain over the horizon, the share of that gain lying within follow-up and the gain lying after it. The restricted means come from HE-FM-ADMC-003 for a Kaplan-Meier curve or from the modelled curves, as in the article's step 6, and the horizon means from an extrapolation such as HE-FM-BTH-002 or HE-FN-CRM-001. The difference of two restricted means is the measure of Royston and Parmar and is not new here; the share phi and the gain after follow-up are derived here. HE-FM-ADMC-004 gives the share of one arm's mean survival that comes from its tail, whereas 1 minus phi is the difference between the arms in the area after tau divided by the gain over the horizon, which depends on both arms' means as well as their tail shares (derived here).