Learn R Programming

rifreg (version 1.1.0)

compute_gini: Compute Gini coefficient

Description

Compute a weighted Gini coefficient by integrating the generalized Lorenz curve.

Usage

compute_gini(dep_var, weights)

Value

The numeric value indicating the weighted Gini coefficient of the the dependent variable.

Arguments

dep_var

values of a non-negative continuous variable

weights

numeric vector of non-negative observation weights, hence of same length as dep_var.

References

Firpo, Sergio P., Nicole M. Fortin, and Thomas Lemieux. 2018. “Decomposing Wage Distributions Using Recentered Influence Function Regressions.” Econometrics 6(2), 28.

Examples

Run this code

set.seed(123)
dep_var <- rlnorm(100)
weights <- rep(1, 100)
compute_gini(dep_var, weights)

Run the code above in your browser using DataLab