gini, gini ignore blanks, gini ignore zero
Calculates the gini coefficient (e.g. to identify the income disparity) of a set of values. This function will also return the corresponding Lorenz curve
if a 2nd parameter is provided.
The suffix ... ignore zero excludes all zero values. Note: Blank values are also considered zero and are therefore ignored
The suffix ... ignore blanks excludes blank values, but includes zeros.
1-2
No. | Type | Description |
---|---|---|
1 input |
set | input values The set shall contain numerals and/or blank strings. |
Opt. 2 code |
variable | Lorenz curve Specify a variable name to which the set of numbers describing the Lorenz curve will be written to. The variable will be created if it does not exist yet. |
Type | Description |
---|---|
numeral | Gini coefficient |
1st parameter is not a set containing positive numerals and/or blank strings.
echo( gini( { 1,1,1,1,1 } ) ); // Everyone is equal, returns 1
echo( gini( { 1, 1.2, 1.3, 1, 1.4, 1.2 } ) ); // ca 0.93, some dispartiy
echo( gini( { 1, 1, 1, 1, 16 }, lorenz[] ) ); // 0.4, big disparity
echo( "Lorenz curve: ", lorenz[] );
1
0.9319248826
0.4
Lorenz curve: {0,0.05,0.1,0.15,0.2,1}