Lorenz curve graphing tool & Gini coefficient calculator

March 5, 2011. Revised January 25, 2012

Enter incomes in the box on the left and click the Calculate button. The Lorenz curve (blue line) will be recalculated. The Gini index (being the Gini coefficient expressed as a percentage) and the Robin Hood index for the curve will also be recalculated.

Hover over a point on the curve to obtain information about it.

Incomes

% of income
% of population


The Lorenz curve, the Gini index and the Robin Hood index

Lorenz curves represent the distribution of income in an economy. A point (x,y) on a Lorenz curve shows the percentage y of total income in an economy enjoyed by the poorest x% of the population.

The Gini index measures income inequality in an economy. It ranges from 0 (perfect income equality) to 100 (perfect income inequality). For example, Australia has a Gini index of 30.5 (2006) and the United States has a a Gini index of 45.0 (2007) [source: CIA Factbook].

The yellow line in the above graph is the line of perfect income equality. It is the Lorenz curve for an economy in which all incomes are equal.

The Gini index for a set of incomes is calculated from the associated Lorenz curve. It is equal to the area between that curve and the line of perfect income equality, scaled to a number between 0 and 100. The Gini coefficient is the Gini index expressed as a number between 0 and 1.

The Robin Hood index is another measure of income inequality. Like the Gini index, it ranges from 0 (perfect equality) to 100 (perfect inequality) and is calculated from the Lorenz curve associated with a given set of incomes. It is the maximum vertical distance between that curve and the line of perfect income equality. It is equal to the portion of total income that would have to be taken from the richer half of the population and given to the poorer half to bring the economy to income equality.

The spreadsheet

At the request of several students, I have created this Lorenz Curve Calculation Spreadsheet (XLSX, 0.1 MB). Enter incomes in the leftmost column and the sheet will calculate the points in the Lorenz curve. It also calculates the Gini index and the Robin Hood index.

Calculation steps

Suppose that n incomes have been supplied. The Lorenz curve may then be described by n+1 points. Call these (x1,y1),...,(xn+1,yn+1).

To determine these points, first reorder the supplied incomes smallest to largest. Next, determine cumulative totals for the incomes. Call these c1,...,cn+1. We then have xi=100(i-1)/n and yi=100(ci/cn+1) for i=1,...,n+1.

Note, of course, that (x1,y1)=(0,0) and (xn+1,yn+1) = (100,100). Also note that cn+1 is the sum of all incomes.

The Gini index equals 100 + (100 - 2S)/n where S=y1+...+yn+1. This can easily be proved using basic high school mathematics. The Gini coefficient is the Gini index divided by 100.

The Robin Hood index is simply the maximum of xi-yi for i=1,...,n+1.

Credits: I created this tool using the Flot Javascript plotting library for jQuery.