Learn R Programming

REAT (version 1.2.1)

gini: Gini coefficient and Lorenz curve

Description

Calculating the Gini coefficient of inequality (or concentration), standardized and non-standardized, and plotting the Lorenz curve

Usage

gini(x, coefnorm = FALSE, lc = FALSE, lcx = "% of objects", lcy = "% of regarded variable", lctitle = "Lorenz curve", lcg = FALSE, lcgn = FALSE)

Arguments

x
A numeric vector (e.g. dataset of household income, sales turnover or supply)
coefnorm
logical argument that indicates if the function output is the non-standardized or the standardized Gini coefficient (default: coefnorm = FALSE, that means the non-standardized Gini coefficient is returned)
lc
logical argument that indicates if the Lorenz curve is plotted additionally (default: lc = FALSE, so no Lorenz curve is displayed)
lcx
if lc = TRUE (plot of Lorenz curve), lcx defines the x axis label
lcy
if lc = TRUE (plot of Lorenz curve), lcy defines the y axis label
lctitle
if lc = TRUE (plot of Lorenz curve), lctitle defines the overall title of the Lorenz curve plot
lcg
if lc = TRUE (plot of Lorenz curve), the logical argument lcg defines if the non-standardized Gini coefficient is displayed in the Lorenz curve plot
lcgn
if lc = TRUE (plot of Lorenz curve), the logical argument lcgn defines if the standardized Gini coefficient is displayed in the Lorenz curve plot

Value

A single numeric value of the Gini coefficient ($0 < G < 1$) or the standardized Gini coefficient ($0 < G* < 1$) and, optionally, a plot of the Lorenz curve.

Details

The Gini coefficient (Gini 1912) is a popular measure of statistical dispersion, especially used for analyzing inequality or concentration of income, wealth or sales turnover of competing firms. The coefficient ($G$) varies between 0 (no inequality/concentration) and 1 (complete inequality/concentration). The Lorenz curve (Lorenz 1905), though developed independently, can be regarded as a graphical representation of the degree of inequality calculated by the Gini coefficient and can also be used for additional interpretations of $G$. The curve displays the deviations of the empirical distribution from a perfectly equal distribution as the difference between two graphs (the distribution curve and a diagonal line of perfect equality). This function calculates $G$ and plots the Lorenz curve optionally. As there are several ways to calculate the Gini coefficient, this function uses the formula given in Doersam (2004). Because the maximum of $G$ is not equal to 1, also a standardized coefficient ($G*$) with a maximum equal to 1 can be calculated alternatively.

References

Aoyama, Y./Murphy, J. T./Hanson, S. (2011): “Key Concepts in Economic Geography”. London : SAGE.

Cerlani, L./Verme, P. (2012): “The origins of the Gini index: extracts from Variabilita e Mutabilita (1912) by Corrado Gini”. In: The Journal of Economic Inequality, 10, 3, p. 421-443.

Doersam, P. (2004): “Wirtschaftsstatistik anschaulich dargestellt”. Heidenau : PD-Verlag.

Gini, C. (1912): “Variabilita e Mutabilita”. Contributo allo Studio delle Distribuzioni e delle Relazioni Statistiche. Bologna : Cuppini.

Lessmann, C. (2005): “Regionale Disparitaeten in Deutschland und ausgesuchten OECD-Staaten im Vergleich”. ifo Dresden berichtet, 3/2005. https://www.cesifo-group.de/link/ifodb_2005_3_25-33.pdf.

Lorenz, M. O. (1905): “Methods of Measuring the Concentration of Wealth”. In: Publications of the American Statistical Association, 9, 70, p. 209-219.

See Also

cv, gini.conc, gini.spec, herf

Examples

Run this code
# Example from Doersam (2004):
sales <- c(20,50,20,10)
# sales turnover of four car manufacturing companies
gini(sales, lc=TRUE, lcx="percentage of companies", lcy="percentrage of sales", 
lctitle="Lorenz curve of sales", lcg=TRUE, lcgn=TRUE)
# returs the non-standardized Gini coefficient (0.3) and 
# plots the Lorenz curve with user-defined title and labels 
gini(sales, coefnorm=TRUE)
# returns the standardized Gini coefficient (0.4)

# Gini concentration of physicians
data(health4)
gini(health4$phys_gen)

# Regional disparities in Germany:
gdp <- c(460.69, 549.19, 124.16, 65.29, 31.59, 109.27, 263.44, 39.87, 258.53, 
645.59, 131.95, 35.03, 112.66, 56.22, 85.61, 56.81)
# GDP of german regions 2015 (in billion EUR)
gini(gdp)
# returs the non-standardized Gini coefficient (0.5009)

Run the code above in your browser using DataLab