Gini Coefficient
Two quantities share this name, and they are computed from different curves.
Corrado Gini’s 1912 coefficient measures inequality in a distribution. Plot the cumulative share of income against the cumulative share of the population — the Lorenz curve — and the coefficient is the area between that curve and the line of perfect equality, normalized by the whole triangle:
\[ Gini = \frac{A}{A + B} \]
In credit risk, “Gini” means something else: a rescaling of the area under the ROC curve.
\[ Gini = 2 \times AUROC - 1 \]
AUROC of 0.5 gives 0, of 1.0 gives 1, and below 0.5 gives a negative value. This is a linear transformation, so it carries exactly the information AUROC carries and nothing more. Finance reports it anyway, by convention and for regulatory model validation.
The two are related by analogy, not by arithmetic
import numpy as np
from sklearn.metrics import roc_auc_score
rng = np.random.default_rng(0)
n = 200_000
default = (rng.random(n) < 0.08).astype(int)
score = 1 / (1 + np.exp(-(rng.normal(np.where(default == 1, 1.4, 0.0), 1.0, n) - 2.4)))
"""A credit scorecard: 8% of borrowers default, and the score ranks them."""
auc = roc_auc_score(default, score)
print(f"AUROC {auc:.4f} the credit-risk Gini, 2 x AUROC - 1 = {2 * auc - 1:.4f}")
def lorenz_gini(values):
"""The economics Gini: twice the area between the equality line and the Lorenz curve."""
v = np.sort(values)
k = len(v)
return (2 * np.sum((np.arange(1, k + 1)) * v)) / (k * v.sum()) - (k + 1) / k
print(f"the economics Gini of the same predicted probabilities: {lorenz_gini(score):.4f}")
print(f"the economics Gini of the same borrowers' incomes: "
f"{lorenz_gini(rng.lognormal(10.6, 0.7, n)):.4f}")
print("\nSame word, three numbers. Only the first is a statement about the model's ranking.")
# AUROC 0.8353 the credit-risk Gini, 2 x AUROC - 1 = 0.6706
# the economics Gini of the same predicted probabilities: 0.4601
# the economics Gini of the same borrowers' incomes: 0.3797
#
# Same word, three numbers. Only the first is a statement about the model's ranking.
The analogy is appealing and it is usually taken too far. Sorting customers by score and accumulating does produce a Lorenz-shaped curve, and the area between it and the equality line, normalized by the area under the equality line, is a Gini coefficient in Gini’s sense. It is a different number from the one the credit team reports: 0.4601 against 0.6706 on the same scores.
They differ because they accumulate different things. The economics Gini accumulates the magnitude of the values themselves, so it measures how unequally the predicted probabilities are spread. The credit-risk Gini accumulates outcomes against rank, so it measures whether the defaulters are sorted above the non-defaulters. A scorecard that gives everyone a probability between 0.07 and 0.09 in a perfect order would have a near-zero economics Gini and a near-perfect credit-risk Gini.
So when a stakeholder asks what the Gini is, the answer depends on who is asking. In a model validation pack it means \(2 \times AUROC - 1\). Anywhere near a discussion of income, wealth or market concentration it means Gini’s original measure. Write the formula next to the number.
Reading the credit-risk figure
Because it is AUROC rescaled, a difference in Gini is twice the difference in AUROC — which is part of why it is popular. Moving a model from 0.72 to 0.85 AUROC reads as 0.44 to 0.70 in Gini, and the second pair looks more like progress.
Conventional bands in consumer credit put roughly 0.20–0.30 at weak, 0.40–0.50 at useful and 0.60–0.70 at strong, with values above 0.80 rare enough that they are usually worth investigating for leakage. Those bands are specific to that domain. Gini 0.80 is AUROC 0.90, which is unremarkable in medical imaging or fraud detection, so the heuristic travels badly.
Gini inherits the corresponding ROC-AUC limitations. A strictly increasing score transformation preserves its value on the same evaluation set, whereas a transformation that introduces ties need not. A high Gini does not establish calibrated probabilities, useful precision at a chosen cut-off, or equitable outcomes across groups; inspect those properties separately.
Report it beside a calibration check and the precision at the cut-off you actually use. On its own it answers one question — does the score sort — which is necessary and not sufficient. The article on discriminatory power has a case where Gini and the KS statistic rank two models in opposite orders.
References
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
