Skip to content

palma_ratio

palma_ratio

palma_ratio(values) -> float

Palma ratio: the top-10% share over the bottom-40% share.

The modern measure of extreme inequality, more sensitive than the Gini to the tails: the total quantity held by the best-served 10% of stations divided by that of the least-served 40%.

See Also

theil_index : A decomposable inequality alternative. concentration_metrics : Gini + Theil + top-decile share in one call.

Examples:

>>> round(palma_ratio(list(range(1, 11))), 1)
1.0
Source code in src/gbfs_toolkit/analytics/distribution.py
def palma_ratio(values) -> float:
    """Palma ratio: the top-10% share over the bottom-40% share.

    The modern measure of *extreme* inequality, more sensitive than the Gini to the
    tails: the total quantity held by the best-served 10% of stations divided by
    that of the least-served 40%.

    See Also
    --------
    [`theil_index`][gbfs_toolkit.theil_index] : A decomposable inequality alternative.
    [`concentration_metrics`][gbfs_toolkit.concentration_metrics] : Gini + Theil + top-decile share in one call.

    Examples
    --------
    >>> round(palma_ratio(list(range(1, 11))), 1)
    1.0
    """
    x = np.sort(np.asarray(values, dtype="float64"))
    x = x[np.isfinite(x)]
    n = x.size
    if n == 0 or x.sum() == 0:
        return float("nan")
    bottom40 = x[: int(np.floor(0.4 * n))].sum()
    top10 = x[int(np.ceil(0.9 * n)) :].sum()
    if bottom40 <= 0:
        return float("inf")
    return float(top10 / bottom40)