Calculate points on the Lorenz curve. TO BE DOCUMENTED.
Usage
get_lorenz(
.data,
welfare,
weight,
distribution_type = c("micro", "group", "aggregate", "imputed"),
nbins = NULL
)
Arguments
- .data
Household survey data frame with at least a welfare variable.
- welfare
numeric: A vector of income or consumption values.
- weight
numeric: A vector of weights. Default is a vector of ones,
rep(1, length(welfare))
.- distribution_type
character: Type of distribution, either micro, group, aggregate or imputed.
- nbins
numeric: number of points on the Lorenz curve. if
NULL
the returning Lorenz curve would be the length of the original welfare vector minus the number ofNAs
of different observations inwelfare
andweight
. Default is100
forlength(welfare) > 1000
and20
otherwise.
Examples
data("md_ABC_2000_income")
df <- md_ABC_2000_income
lorenz <- get_lorenz(df, welfare, weight)
#> ℹ Data has been sorted by variable "welfare"
str(lorenz)
#> 'data.frame': 2000 obs. of 3 variables:
#> $ welfare : num 0 64547 81078 83195 89137 ...
#> $ lorenz_welfare: num 0.00 9.49e-06 1.72e-05 2.18e-05 2.35e-05 ...
#> $ lorenz_weight : num 0.00012 0.000625 0.000951 0.001141 0.001208 ...