Skip to contents

Compute the Gini coefficient for microdata.

Usage

md_compute_gini(welfare, weight)

Arguments

welfare

numeric: A vector of income or consumption values

weight

numeric: A vector of population weights, optional, a vector of 1s if not specified.

Value

numeric

Details

Given a vector of income or consumption values and their respective weights md_compute_gini() computes the Gini coefficient for the distribution.

Examples

md_compute_gini(welfare = 1:2000, weight = rep(1, 2000))
#> [1] 0.3331667