Notes on Calculating Gini Coefficients...¶

Gini coefficient $G$:

• Top $1/5$ receives $4/5$: $G = 3/5$
• Top $1/4$ receives $3/4$: $G = 1/2$
• Top $1/3$ receives $2/3$: $G = 1/3$

Wikipedia: Gini Coefficient https://en.wikipedia.org/wiki/Gini_coefficient: "In economics, the Gini coefficient (/ˈdʒiːni/ JEE-nee), sometimes called Gini index, or Gini ratio, is a measure of statistical dispersion intended to represent the income or wealth distribution of a nation's residents, and is the most commonly used measurement of inequality. It was developed by the Italian statistician and sociologist Corrado Gini and published in his 1912 paper Variability and Mutability (Italian: Variabilità e mutabilità) https://link.springer.com/article/10.1007/s10888-011-9188-x...

...The Gini coefficient measures the inequality among values of a frequency distribution (for example, levels of income). A Gini coefficient of zero expresses perfect equality, where all values are the same (for example, where everyone has the same income). A Gini coefficient of 1 (or 100%) expresses maximal inequality among values (e.g., for a large number of people, where only one person has all the income or consumption, and all others have none, the Gini coefficient will be very nearly one). However, a value greater than one may occur if some persons represent negative contribution to the total (for example, having negative income or wealth).... For OECD countries, in the late 20th century, considering the effect of taxes and transfer payments, the income Gini coefficient ranged between 0.24 and 0.49, with Slovenia being the lowest and Chile the highest....

An informative simplified case just distinguishes two levels of income, low and high. If the high income group is a proportion $u$ of the population and earns a proportion $f$ of all income, then the Gini coefficient is $f − u$. An actual more graded distribution with these same values u and f will always have a higher Gini coefficient than $f − u$...

class gini

delong_classes.gini()
delong_classes.gini.upper_class
delong_classes.gini.share
delong_classes.gini.income_ratio



In [3]:
# class gini, for getting a sense of what a Gini coefficient
# means, at least in the context of a two-class income
# distribution...
#
# I find that the measure I want is some combination of (a)
# how much richer the rich are as a multiple of the wealth
# and income of the poor, divided by something that increases
# as the proportion of the rich in the population goes up.
# My intuition is that a society with a substantial upper-
# middle class is in some sense less unequal than one with
# a small upper class, even if the higher class's wealth and
# income is the same multiple of the lower class's in both
# cases.
#
# This may be wrong. But it is my intuition. And the Gini does
# not really do this...
#
# This class will be kept in delong_classers...

import numpy as np

class gini:
"""
For a two-class distribution of income. Initialize
the class with a size-of-upper-class variable
equal to 1/5 and a share-of-upper-class variable
equal to 4/5
"""

def __init__(self,
upper_class = 1/5,       # size of upper class
share = 4/5              # share of upper class
):
self.upper_class = upper_class
self.share = share
self.gini_value = self.share - self.upper_class
self.income_ratio = ((self.share/self.upper_class)/
((1-self.share)/(1-self.upper_class)))

In [6]:
# print a table calculating the Gini coefficient and the
# wealth of the upper class as a multiple of the wealth
# of the lower class for an upper class of i% that receives
# 1-i% of the income

import pandas as pd

Upper = []
Gini = []
Ratio = []

for i in range(1,51):
working = gini(upper_class=i/100, share=1-i/100)
Upper = Upper + [i/100]
Gini = Gini + [working.gini_value]
Ratio = Ratio + [working.income_ratio]

gini_df = pd.DataFrame()
gini_df['Upper'] = Upper
gini_df['Gini'] = Gini
gini_df['Ratio'] = Ratio

print("")
print("SIZE OF UPPER CLASS, GINI, AND WEALTH RATIO")
print("")
print(gini_df)

SIZE OF UPPER CLASS, GINI, AND WEALTH RATIO

Upper  Gini        Ratio
0    0.01  0.98  9801.000000
1    0.02  0.96  2401.000000
2    0.03  0.94  1045.444444
3    0.04  0.92   576.000000
4    0.05  0.90   361.000000
5    0.06  0.88   245.444444
6    0.07  0.86   176.510204
7    0.08  0.84   132.250000
8    0.09  0.82   102.234568
9    0.10  0.80    81.000000
10   0.11  0.78    65.462810
11   0.12  0.76    53.777778
12   0.13  0.74    44.786982
13   0.14  0.72    37.734694
14   0.15  0.70    32.111111
15   0.16  0.68    27.562500
16   0.17  0.66    23.837370
17   0.18  0.64    20.753086
18   0.19  0.62    18.174515
19   0.20  0.60    16.000000
20   0.21  0.58    14.151927
21   0.22  0.56    12.570248
22   0.23  0.54    11.207940
23   0.24  0.52    10.027778
24   0.25  0.50     9.000000
25   0.26  0.48     8.100592
26   0.27  0.46     7.310014
27   0.28  0.44     6.612245
28   0.29  0.42     5.994055
29   0.30  0.40     5.444444
30   0.31  0.38     4.954214
31   0.32  0.36     4.515625
32   0.33  0.34     4.122130
33   0.34  0.32     3.768166
34   0.35  0.30     3.448980
35   0.36  0.28     3.160494
36   0.37  0.26     2.899196
37   0.38  0.24     2.662050
38   0.39  0.22     2.446417
39   0.40  0.20     2.250000
40   0.41  0.18     2.070791
41   0.42  0.16     1.907029
42   0.43  0.14     1.757166
43   0.44  0.12     1.619835
44   0.45  0.10     1.493827
45   0.46  0.08     1.378072
46   0.47  0.06     1.271616
47   0.48  0.04     1.173611
48   0.49  0.02     1.083299
49   0.50  0.00     1.000000