Functions & Formulae

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

Decision curve net benefit of a risk model or test across threshold probabilities

NB(p_t) = TP(p_t) / n - FP(p_t) / n * p_t / (1 - p_t)

Maps a risk model's or test's classifications in a validation sample, at a chosen threshold probability, to net benefit: true positives per patient minus false positives per patient weighted by the odds at the threshold, so that both are counted in units of true positives. Repeating the calculation over a preset range of thresholds, for the model and for intervening in everyone or no one, gives the decision curve. The notation follows the Decision Curve Analysis article; the economic net benefit of an option at a cost-effectiveness threshold is a different quantity (HE-FM-NMB-001).

  • Net benefit of a risk model at one threshold probability

    NB = TP / n - FP / n * p_t / (1 - p_t)

    Counts patients whose predicted risk is at or above the threshold as positive. True positives per patient are credited in full and false positives per patient are charged at the odds of the threshold, p_t / (1 minus p_t), the exchange rate between an unnecessary intervention and a case found. A net benefit of 0.07 equals intervening in 7 patients per 100, all of whom have the event, and in no one else. The maximum is the prevalence and there is no lower limit.

  • Net benefit of intervening in every patient at a threshold probability

    NB_all = pi - (1 - pi) * p_t / (1 - p_t)

    Classes every patient as positive, so true positives per patient equal the prevalence and false positives per patient its complement. The line falls as the threshold rises and crosses zero, the net benefit of intervening in no one, where the threshold equals the prevalence. A model is of value at a threshold only if it beats both defaults.

  • Net unnecessary interventions avoided per 100 patients by a risk model

    avoided = (NB_model - NB_all) * (1 - p_t) / p_t * 100

    Restates the gain in net benefit over intervening in everyone as unnecessary interventions avoided, net of extra missed cases, by dividing by the false positive weight. It is recommended when intervening in everyone is current practice and does not change which strategy has the highest net benefit.

  • Decision curve threshold probability from the benefit to a case and the harm to a non-case

    p_t = L / (G + L)

    Sets the threshold at which a rational decision maker is indifferent between intervening and not, given the expected benefit of intervening for a patient who has or will have the event and the expected harm of intervening for one who does not. Equivalently the odds p_t / (1 minus p_t) equal L / G. Harm can include money, time, stress and adverse health effects, as long as G and L share a unit.

  • Expected monetary gain per patient from decision curve net benefit

    V = G * TP / n - L * FP / n

    Values the classifications at a threshold with an explicit benefit per case found and harm per unnecessary intervention, compared with intervening in no one. When the threshold is set at L / (G + L), the result equals G times decision curve net benefit, which links the decision curve to an economic model's values.