# inequality¶

quantecon.inequality.gini_coefficient(y)[source]

Implements the Gini inequality index

Parameters:
yarray_like(float)

Array of income/wealth for each individual. Ordered or unordered is fine

Returns:
Gini index: float

The gini index describing the inequality of the array of income/wealth

References

https://en.wikipedia.org/wiki/Gini_coefficient

quantecon.inequality.lorenz_curve(y)[source]

Calculates the Lorenz Curve, a graphical representation of the distribution of income or wealth.

It returns the cumulative share of people (x-axis) and the cumulative share of income earned.

Parameters:
yarray_like(float or int, ndim=1)

Array of income/wealth for each individual. Unordered or ordered is fine.

Returns:
cum_peoplearray_like(float, ndim=1)

Cumulative share of people for each person index (i/n)

cum_incomearray_like(float, ndim=1)

Cumulative share of income for each person index

References

Examples

>>> a_val, n = 3, 10_000
>>> y = np.random.pareto(a_val, size=n)
>>> f_vals, l_vals = lorenz(y)

quantecon.inequality.rank_size(data, c=1.0)[source]

Generate rank-size data corresponding to distribution data.

Parameters:
dataarray_like

the set of observations

cint or float

restrict plot to top (c x 100)% of the distribution

Returns:
rank_dataarray_like(float, ndim=1)

Location in the population when sorted from smallest to largest

size_dataarray_like(float, ndim=1)

Size data for top (c x 100)% of the observations

Examples

>>> y = np.exp(np.random.randn(1000))  # simulate data
>>> rank_data, size_data = rank_size(y, c=0.85)

quantecon.inequality.shorrocks_index(A)[source]

Implements Shorrocks mobility index

Parameters:
Aarray_like(float)

Square matrix with transition probabilities (mobility matrix) of dimension m

Returns:
Shorrocks index: float

The Shorrocks mobility index calculated as

$s(A) = \frac{m - \sum_j a_{jj} }{m - 1} \in (0, 1)$

An index equal to 0 indicates complete immobility.

References



Wealth distribution and social mobility in the US: A quantitative approach (Benhabib, Bisin, Luo, 2017). https://www.aeaweb.org/articles?id=10.1257/aer.20151684