Functions & Formulae

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

Adverse event rate to model input function

f(n, N, T, t) = p_t; g(p_k, c_k, u_k, tau_k) = (C_AE, Q_AE)

Maps the adverse event counts in a trial safety table, with their denominators of patients or person-time, to the probability of an event in one model cycle, and maps those probabilities to the expected adverse event cost and QALY loss per patient. The general rate and probability conversions are on the Transition Probability page (HE-FN-TP-001); the records here apply them to adverse event data and add the cost and QALY weighting.

  • Adverse event proportion over a trial follow-up period

    P = n / N

    Divides the number of patients with at least one episode of a stated adverse event by the number of patients at risk at the start of follow-up. The result is the cumulative incidence over that period, so it belongs to the period and is not a rate per week or a probability per model cycle.

  • Adverse event rate per unit of person-time

    r = d / PT

    Divides the number of adverse events counted by the total person-time at risk. The result is an incidence rate: it can exceed 1, depends on the time unit, and allows a fair comparison between arms treated for different lengths of time.

  • Per-cycle adverse event probability rescaled from a trial proportion

    r = -log(1 - P) / T; p_t = 1 - exp(-r * t)

    Turns the proportion of patients with an adverse event over the trial follow-up period T into the probability of a first episode within a model cycle of length t in two steps: it recovers the implied constant rate r, then converts that rate to the cycle probability with the constant-rate conversion HE-FM-TP-001 on the Transition Probability page. The second step also applies to a rate per person-time from HE-FM-AER-002. The two steps together equal the single-step form 1 minus (1 minus P) raised to the power t/T, the rescaling formula HE-FM-TP-003 applied to trial safety data. Dividing P by the number of cycles is not equivalent, because probabilities do not add over time in the way rates do. The function log is the natural logarithm and exp is the exponential function.

  • Expected adverse event cost per patient

    C_AE = sum_(k=1)^K [p_k * c_k]

    Weights the cost of managing one episode of each adverse event type by the probability of that event and adds the products over the K event types included. The probabilities cover the period that the model costs, for example the 24-week trial period or the cycles on treatment.

  • Expected QALY loss from adverse events per patient

    Q_AE = sum_(k=1)^K [p_k * u_k * tau_k]

    Multiplies the probability of each adverse event type by the utility decrement during an episode and by the episode's duration in years, and adds the products over the K event types. The result is subtracted from the QALY total of the arm as a one-off decrement.