Learn R Programming

GiniDecompLY (version 1.0.1)

gini_decomp_source: Gini decomposition by income sources

Description

This function provides a decomposition of Gini index by income sources based on the approach of Lerman and Yitzhaki (1985) doi:10.2307/1928447 . It provides a set of indicators :

  • income_source: Column indicating each income source passed into the function call.

  • Share: Column indicating the share of the income source to the total income.

  • Gini: Column showing the Gini index for each income source.

  • Gini_corr: Column showing the Gini correlation between the income source and the total income.

  • Absolute_Contribution: Column showing the absolute contribution of each income source to the global Gini index.

  • Relative_Contribution: Column indicating the relative contribution of each income source to the global Gini index.

Usage

gini_decomp_source(.data, ..., .by = NULL, .wgt = NULL)

Value

An object of class data.frame containing all the calculated indicators. The data.frame is grouped by the columns passed into .by argument.

Arguments

.data

A data frame, or data frame extension (e.g. a tibble)

...

One or more unquoted expressions separated by commas indicating income sources to consider in the decomposition. Variable names can be used as if they were positions in the data frame.

.by

A column to group the calculations by.

.wgt

an optional vector of weights to apply in computation. Should be NULL or a numeric vector.

Examples

Run this code

sample_income_data %>%
  gini_decomp_source(wage, self_employment_rev, farming_rev, other_rev)

gini_decomp_source(sample_income_data, 3:6, .by = region, .wgt = sample_wgt)

Run the code above in your browser using DataLab