gini function

Compute the Gini Coefficient

Compute the Gini Coefficient

Computes the Gini coefficient based on (possibly weighted) sample data

gini(x, weights=rep(1,length=length(x)))

Arguments

  • x: a vector containing at least non-negative elements
  • weights: an optional vector of sample weights for x

Details

Gini is the Gini coefficient, a common measure of inequality within a distribution. It is commonly used to measure income inequality. It is defined as twice the area between the 45 degree line and a Lorenz curve, where the Lorenz curve is a graph describing the share of total income T accruing to the poorest fraction p of the population.

In typical use the values of x are the incomes of individuals from a survey and the weights are the corresponding survey weights. If the values of x are the mean incomes within income classes and the weights weights are the corresponding population proportions within those classes, the function computes an estimate of the Gini coefficient of the underlying income distribution.

Returns

the Gini coefficient (between 0 and 1).

Source

Relative Distribution Methods in the Social Sciences, by Mark S. Handcock and Martina Morris, Springer-Verlag, Inc., New York, 1999. ISBN 0387987789.

References

Relative Distribution Methods in the Social Sciences, by Mark S. Handcock and Martina Morris, Springer-Verlag, Inc., New York, 1999. ISBN 0387987789.

Divergent Paths: Economic Mobility in the New American Labor Market, Russell Sage Foundation, New York, June 2001 Annette D. Bernhardt, Martina Morris, Mark S. Handcock and Marc Scott.

Measurement of Inequality, by F. A. Cowell, in A. B. Atkinson / F. Bourguignon (Eds): Handbook of Income Distribution, Amsterdam, 2000.

Measuring Inequality, by F. A. Cowell, Prentice Hall/Harvester Wheatshef, 1995.

Author(s)

Mark S. Handcock handcock@stat.ucla.edu

See Also

reldist, nls

Examples

# generate vector (of incomes) x <- c(541, 1463, 2445, 3438, 4437, 5401, 6392, 8304, 11904, 22261) # compute Gini coefficient gini(x) # generate a vector of weights. w <- runif(n=length(x)) gini(x,w) # # Compute the inequality in income growth for the recent cohort of the # National Longitudinal Survey (NLS) initiated in 1979. # library(reldist) data(nls) help(nls) # Compute the wage growth y <- exp(recent$chpermwage) # Compute the unweighted estimate gini(y) # Compute the weighted estimate gini(y,w=recent$wgt)