Learn R Programming

lawstat (version 3.2)

lorenz.curve: Lorenz Curve

Description

This function plots the Lorenz curve that is a graphical representation of the cumulative distribution function. A user can choose for the Lorenz curve with single (default) or multiple weighting of data, for example, taking into account for single or multiple legislature representatives.

The input data should be a data frame with 2 columns. The first column will be treated as data vector, and the second column to be treated as a weight vector. Alternatively, data and weight can be entered as separate one-column vectors.

Usage

lorenz.curve(data, weight=NULL, mul=FALSE, plot.it=TRUE, 
   main=NULL, xlab=NULL, ylab=NULL, xlim=c(0,1), ylim=c(0,1), ... )

Arguments

data

input data. If the argument is an array, a matrix, a data.frame, or a list with two or more columns, then the first column will be a treated as a data vector, and the second column to be treated as a weight vector. A separate weight vector is then ignored and not required. If the argument is a single column vector, then a user must enter a separate single-column weight vector. NA or character is not allowed.

weight

single column vector contains factors of single or multiple weights. Ignored if already included in the data argument. NA or character is not allowed.

mul

logical value indicates whether the Lorenz Curve with multiple weight is to be plotted. Default is single.

plot.it

logical value indicates whether the Lorenz Curve should be plotted on screen. Default is to plot.

main

Title of Lorenz Curve. Only required if user wants to override the default value.

xlab

label of x-axis. Only required if user wants to override the default value.

ylab

label of y-axis. Only required if user wants to override the default value.

xlim

plotting range of x-axis. Only required if user wants to override the default value.

ylim

plotting range of y-axis. Only required if user wants to override the default value.

other graphical parameters to be passed to the plot function.

Value

x

Culmulative fraction of the data argument.

y

Culmulative fraction of the weight argument.

gini

The Gini index of the input data.

relative.mean.dev

Relative Mean Deviation of the input data.

L(1/2)

Median of the culmulative fraction sum of the data.

References

Gastwirth, J. L.(1972) The Estimation of the Lorenz Curve and Gini Index, The Review of Economics and Statistics, Vol. 54, No. 3. (August 1972), pp. 306-316.

See Also

gini.index

Examples

Run this code
# NOT RUN {
## Population Data of ratio of number of senators (second column) and 
## representatives (third column) to population size (first column) in 1963
## First column is treated as data argument.

data(data1963)

## Single weight Lorenz Curve using number of senators as weight argument.
lorenz.curve(data1963)

## Multiple weight Lorenz Curve using number of senators as weight argument.
lorenz.curve(data1963, mul=TRUE)

## Multiple weight Lorenz Curve using number of representatives 
## as weight argument.
lorenz.curve(data1963[,"pop1963"], data1963[,"rep1963"], mul=TRUE)

# }

Run the code above in your browser using DataLab