Learn R Programming

SciencesPo (version 1.3.9)

lorenz: The Lorenz Curve

Description

Computes the (empirical) ordinary and generalized Lorenz curve of a vector.

Usage

lorenz(x, n = rep(1, length(x)), plot = FALSE, ...)

lorenz(x, n = rep(1, length(x)), plot = FALSE, ...)

Arguments

x
A vector of non-negative values.
n
A vector of frequencies of the same length as x.
plot
A logical. If TRUE the Lorenz curve will be plotted.
...
Additional arguements (currently ignored)

encoding

UTF-8

Details

The Gini coefficient ranges from a minimum value of zero, when all individuals are equal, to a theoretical maximum of one in an infinite population in which every individual except one has a size of zero. It has been shown that the sample Gini coefficients originally defined need to be multiplied by n/(n-1) in order to become unbiased estimators for the population coefficients.

See Also

gini, gini.simpson.

Examples

Run this code
# generate a vector (of incomes)
x <- c(778, 815, 857, 888, 925, 930, 965, 990, 1012)
# compute Lorenz values
lorenz(x)
# generate some weights:
wgt <- runif(n=length(x))
# compute the lorenz with especific weights
lorenz(x, wgt)

Run the code above in your browser using DataLab