TI-84 Plus CE: Lorenz Curves and the Gini Coefficient
Introduction - Graphing Income Inequality
Developed by Max O. Lornez, the Lorenz curve displays the graphs of income distribution and income inequality. Each point of represents a cumulative percentage of an income level. An example of a Lorenz curve:
(25%, 9%): The first 25% of a population earns 9% of the population's total income
(50%, 21%): Half of the population earns only 21% of the total income.
(75%, 44%): The bottom 75% of the population earns 44% of the total income.
(100%, 100%): This represents the total population.
The Lornez curve is compared against a straight line which connects points (0%, 0%) to (100%, 100%). The ratio between the top area and the whole curve is called a Gini coefficient. If the Gini coefficient is 0, then there is no income inequality. On the other hand, the closer that the Gini coefficient is to 1, there is more income inequality. The diagram below is a Lorenz curve.
Calculating the Gini Coefficient
Let:
A = the area above the Lorenz curve and below the straight line
B = the area above the x axis and below the Lorenz curve
W = the total area = A + B = 1/2 * max(x value) * max(y value)
Note: that the total area is the area of a right triangle
The Gini coefficient is defined as:
G = A / (A + B) = (W - B) / B
TI-84 Plus CE Program: LORENZ
430 bytes
"2020-09-13 EWS"
Menu("LORENZ CURVE", "EQUAL PERCENTILE", 1, "DATA", 2)
Lbl 1
Input "DATA?", L4
dim(L4) → N
cumSum(L4) → L6
seq(100J/N, J, 1, N) → L3
L3 → L5
Goto 3
Lbl 2
Disp "ASCENDING ORDER: Y"
Input "X DATA?", L3
Input "Y DATA?", L4
cumSum(L3) / sum(L3) * 100 → L5
sumSum(L3 * L4) / sum(L3 * L4) * 100 → L6
Goto 3
Lbl 3
"BELOW"
augment( {0}, L5 ) → L5
augment( {0}, L6 ) → L6
sum( seq(.5 * (L5(J) - L5(J-1)) * (L6(J) + L6(J-1)) /2 , J, 2, dim(L6) ) ) → B
"WHOLE"
.5 * max(L5) * max(L6) → W
(W - B) / W → G
Disp "GINI INDEX:", G
Pause
Func
PlotsOff
FnOff
FnOn 1
PlotsOn 1
10 → Xscl : 10 → Yscl
Plot1( xyLine, L5, L6, □, RED)
"max(L6)*X/100" → Y1
ZoomStat
Percentile | Percent of Health Spending |
---|---|
10% | 0% |
20% | 0.1% |
30% | 0.6% |
40% | 1.2% |
50% | 2% |
60% | 3.4% |
70% | 5.4% |
80% | 9.1% |
90% | 16.5% |
100% | 61.7% |
Number of Employees | Hourly Wage |
---|---|
156 | $15.00 |
195 | $30.00 |
53 | $50.00 |
49 | $70.00 |