Functions & Formulae

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

Discrimination AUC as the probability of correct ranking

AUC = P(S_1 > S_0) + 0.5 * P(S_1 = S_0)

Maps the scores that a diagnostic test or risk prediction model gives to people with and without an outcome to a single probability: the chance that a randomly chosen person with the outcome scores higher than a randomly chosen person without it, with tied scores counted as half. S_1 and S_0 are the scores of the two people and P denotes probability. The result has no units, equals 0.5 for a score unrelated to the outcome and 1 for perfect separation, and is the area under the receiver operating characteristic (ROC) curve and the C-statistic for a binary outcome. It measures discrimination only; calibration and the costs and health effects of acting on the score are separate questions.

  • AUC estimated by counting case and non-case pairs

    AUC = (n_conc + 0.5 * n_tie) / (n_1 * n_0)

    Compares every person with the outcome with every person without it. A pair in which the person with the outcome has the higher score counts 1, a tied pair counts one half, and the total is divided by the number of such pairs. This is the article's double sum of psi(s_i, s_j) over all n_1 times n_0 pairs, written with pair counts, and it is the quantity estimated by the Wilcoxon rank statistic.

  • AUC as the trapezoidal area under the empirical ROC curve

    AUC_trap = sum_(k=1)^K [(FPR_end_k - FPR_start_k) * (TPR_start_k + TPR_end_k) / 2]

    Adds the areas of the trapezoids beneath the empirical ROC curve, which plots sensitivity (the true positive rate) against the false positive rate (one minus specificity) at every threshold. Each segment between consecutive points contributes its width on the false positive axis multiplied by the mean of its two heights. Vertical segments add nothing, and the diagonal segment drawn through tied scores supplies the half credit of the pair count, so the result equals HE-FM-AUC-001.

  • Gini index from the discrimination AUC

    Gini = 2 * AUC - 1

    Converts the AUC to the Gini index, defined as twice the area between the ROC curve and the diagonal, using the relation that the Gini index plus 1 equals twice the AUC. The index is 0 for no discrimination and 1 for perfect discrimination. It is a different quantity from the Gini coefficient of income or health inequality.

Area Under Curve — Functions & Formulae | HealthEconomics.wiki