lorenz.curve: Lorenz Curve

View source: R/lorenz.curve.R

lorenz.curveR Documentation

Lorenz Curve

Description

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

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 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. NAs or character are not allowed.

weight

one-column vector contains factors of single or multiple weights. Ignored if included in the data argument. NAs or character are not allowed.

mul

logical value indicates whether the Lorenz curve with multiple weight is to be plotted. Default is FALSE, i.e., single.

plot.it

logical value indicates whether the Lorenz curve should be plotted. Default is TRUE, i.e., 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.

Details

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 weights can be entered as separate one-column vectors.

Value

A Lorenz curve plot with x-axis being the culmulative fraction of the data argument, and y-axis being the culmulative fraction of the weight argument. In the legend to the plot, the following values are reported:

RMD

relative mean deviation of the input data.

GI

the Gini index of the input data.

L(1/2)

median of the culmulative fraction sum of the data.

Author(s)

Man Jin, Wallace W. Hui, Yulia R. Gel, Joseph L. Gastwirth

References

\insertAllCited

See Also

gini.index

Examples

## Data on: number of senators (second column) and 
## representatives (third column) relative to population size (first column) in 1963
## First column is treated as the 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)


lawstat documentation built on April 6, 2023, 1:06 a.m.