# inequality / inequality / inequality-2.0.x

Released by inequality on 2007-07-10 at 16:08.

filesize
inequality-2.0.1.lua_and_python.zip10.3 KB
```Notes:
The Lua 5.1 script "inequality-2.0.0" builds on "inequality-1.4.0".
In the new script the display of redundancies ("Theil" and "symmetric")
has been reactivated and the computation of averages for resources
(e.g. income) has been added: Mean, median and welfare functions.

In case of the median also the amount of quantiles is displayed and the
quantile where the median has been found is indicated. If there are only
few quantiles, you decide, wether the median makes sense.

The formulas for the inequalities and redundancies are explained in
http://www.poorcity.richcity.org (The "Platon" inequality is an experiment.
http://luaforge.net/frs/shownotes.php?release_id=53 will tell you more.
And http://luaforge.net/frs/shownotes.php?release_id=83 explains the
"Europe" inequality.)

The "Welfare Function" is computed as W=mean*(1-Z), where Z is an
inequality. Amartya Sen initially took the Gini inequality for Z, James E.
Foster proposed an Atkinson inequality (or Z=1-exp(-R) with Henri Theil's
redundancy R) and I propose the symmetric inequality for Z.

G.Kluge, 2007-07-10

Example: Quantile data set:

{1145008,2954.348},
{1274868,9680.002},
{1489169,18586.468},
{1309984,22810.086},
{1227877,27624.267},
{1333681,36713.66},
{3136635,110401.129},
{3619401,162869.097},
{3105688,170061.277},
{3252768,217926.704},
{3383398,291369.018},
{3126897,420418.974},
{207672,68629.438},
{49031,32752.279},
{13820,18659.358},
{5249,15461.399},
{1247,8458.446},
{686,14801.379},

Result computed by inequality-2.0.1 for Lua 5.1:

-- Inequalities --
symmetric inequality: 36.6%
Atkinson inequality: 35.4%
Gini inequality: 44.4%
Europe inequality: 61.5%
Hoover inequality: 31.0%
Platon inequality: 45.9%
-- Redundancies --
symmetric redundancy: 0.455
Theil redundancy: 0.437
-- Averages --
27683079 quantile elements
Mean:    2.4586E+00
Median:  1.7024E+00 at #7/18 and #8/18
Welfare: 1.3670E+00 (using Gini)
Welfare: 1.5880E+00 (using Atkinson)
Welfare: 1.5591E+00 (using symm.)

remark: The Platon inequality presently is not displayed,
but the program computes it anyway.

=== Platon inequality ===
Statements:
*  "Platon" inequality: ZP
*  "Symmetric" redundancy (or distance): SYMR
*  E[i] is e.g. total income in a quantile[i]
*  A[i] is e.g. the population in a quantile[i]
*  sumE = sum(E[i]), e.g. income of a society
*  sumA = sum(A[i]), e.g. population of a society
*  i is the index of the quantiles (containing A[i] and E[i])
in a set of quantiles which e.g. describes the resource
distribution in a society.
*  SYMR = sum(ln(sumE/sumA)*(E[i]/sumE-A[i]/sumA)/2
*  "Symmetric" inequality: SYMI = 1 - exp(-SYMR)
*  "Pareto" equality: q
Ranges:
*  ZP and SYMR are relative inequalities between 0 and 1
*  q is a relative equality between 0 and 0.5
*  As q is between 0 and 0.5 and indicates equality, the transformation
ZP = 1 - 2*q is between 0 and 1 and indicates inequality.
*  SYMR is a redundancy >= 0
(redundancy = max.entropy - entropy)
*  pi = 3.1415....
Definition of Platon inequality:
*  SYMI = 1 - (2/(ZP+1)-1)^(ZP).
Approximation (error < 0.002 below ZP=0.78) yields inverse function:
*  ZP = 1 - arcsin((1-SYMI)^(SYMI*0.06+0.61))*2/pi
(The program reduces the error to <0.00001)
Meaning (if q = (1-ZP)/2 with q between 0 and 0.5):
*  A society in which
a share of q people hold a share of 1-q of the resources and
a share of 1-q people hold a share of q of the resources
is entropywise equivalent to a society with
SYMI = 1 - (1/q-1)^(2*q-1).

Changes:
=== 2.0.0 ===
In the new script the display of redundancies ("Theil" and "symmetric")
has been reactivated and the computation of averages for recources
(e.g. income) has been added: Mean, median and welfare functions.

=== 2.0.1 ===
- Python script added to Lua script (core of
http://www.poorcity.richcity.org/cgi-bin/inequality.cgi)
- Display of Median improved
- Coulter not displayed anymore
- Avoidance of numeric computation errors on some platforms
- inequalities.html (small calculus) added to zip archive
```