Functions & Formulae

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

Average treatment effect function

ATE = E[Y(1) - Y(0)]

Maps the two potential outcomes of each patient in a stated population, Y(1) under the treatment and Y(0) under the comparator, to the mean of their difference. Only one potential outcome is observed for any patient, so the mean is computed from subgroup averages or by reweighting observed outcomes under stated conditions. Conditioning on the treated gives the average effect on the treated (ATT), and conditioning on baseline characteristics gives the conditional average effect (CATE). Applied to costs and to QALYs, the two averages are the incremental cost and incremental QALYs used by the pairwise ICER (HE-FM-ICER-001) and the incremental net monetary benefit (HE-FM-NMB-002).

  • ATE as the share-weighted sum of subgroup effects

    ATE = sum_(x=1)^K (P_x * CATE_x)

    Computes the population average treatment effect from the conditional average effects of K non-overlapping subgroups, each weighted by its share of the population of interest. It is the law of total expectation applied to the mean of Y(1) minus Y(0), and the same weights apply to effects on cost and on QALYs.

  • ATT as the treated-mix weighted sum of subgroup effects

    ATT = sum_(x=1)^K (P_x * e_x * CATE_x) / sum_(x=1)^K (P_x * e_x)

    Computes the average treatment effect on the treated (ATT) from the same subgroup effects as HE-FM-ATE-001, reweighted to the subgroup mix of the patients who were actually treated. The product P_x times e_x is the share of the whole population that is treated and in subgroup x, and dividing by the sum of these products gives each subgroup's share of the treated group. When treatment is more likely where the effect is larger, the ATT exceeds the ATE.

  • Inverse probability weighted ATE estimator

    ATE_IPW = (1/n) * sum_(i=1)^n (T_i * Y_i / e_i) - (1/n) * sum_(i=1)^n ((1 - T_i) * Y_i / (1 - e_i))

    Estimates the ATE from patient-level observational data. Each treated patient is weighted by one over the propensity score and each untreated patient by one over one minus the propensity score, so that each weighted arm resembles the whole sample, and the estimate is the difference between the two weighted means. Applied with the same weights to costs and to QALYs, it gives the incremental cost and QALYs for the ICER (HE-FM-ICER-001) and the incremental net monetary benefit (HE-FM-NMB-002).

  • Static value of targeting treatment by subgroup

    V_strat = sum_(x=1)^K (P_x * max(0, INMB_x)) - max(0, sum_(x=1)^K (P_x * INMB_x))

    Measures the expected net monetary benefit per member of the population gained by treating only the subgroups with a positive incremental net monetary benefit, rather than making one decision for everyone on the population average. Each INMB_x comes from HE-FM-NMB-002 with the subgroup's effects on QALYs and cost, and the population value is their share-weighted sum, as in HE-FM-ATE-001. Espinoza and colleagues call this gain the static value of heterogeneity, separate from the value of further research on subgroups.