The Gini coefficient is used in economics to measure income inequality. Generally speaking, it is used to measure the extent of departure from a perfectly even distribution of income. A “0” indicates no departure, i.e. everyone has the same income. A “1” indicates complete departure – all income falls into an infinitely small group.
Here´s how it´s calculated. Arrange all the income groups into ascending order of income; for each group find proportion Xi of this and lower income groups into the whole population and the corresponding share Yi of income, for example, bottom 0.1 (X1) have 0.01 (Y1) of income, bottom 0.3 (X2) have 0.07 (Y2) of income, etc; then
where (assuming X0 = 0). Gini coefficient can be calculated for any number of groups, and the groups may be of different sizes, e.g 4 groups with proportions in the whole population 0.1, 0.3, 0.4, 0.2.