Title: Gini Decomposition by Income Sources
Version: 1.0.1
Description: Estimation of the effect of each income source on income inequalities based on the decomposition of Lerman and Yitzhaki (1985) <doi:10.2307/1928447>.
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
URL: https://github.com/aambarek/GiniDecompLY
BugReports: https://github.com/aambarek/GiniDecompLY/issues
Imports: dplyr, tidyr, magrittr,
Suggests: knitr, rmarkdown, dineq, testthat (≥ 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
Depends: R (≥ 2.10)
NeedsCompilation: no
Packaged: 2024-11-26 14:03:27 UTC; HP
Author: Abdessamad Ait Mbarek [aut, cre]
Maintainer: Abdessamad Ait Mbarek <abdessamad.ambarek@gmail.com>
Repository: CRAN
Date/Publication: 2024-11-26 14:20:02 UTC

Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Value

The result of calling 'rhs(lhs)'.


Gini correlation index

Description

This function calculates the Gini correlation between two distributions.

Usage

gini_corr(x, y, weights = NULL)

Arguments

x

a numeric vector containing at least non-negative elements.

y

a numeric vector containing the distribution with the rank information.

weights

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

Value

The value of the Gini correlation, should be between -1 and 1.

References

E. Schechtman and S. Yitzhaki (1999) On the proper bounds of the Gini correlation, Economics Letters,Volume 63, Issue 2, p. 133-138, ISSN 0165-1765

Handcock, M. (2016), Relative Distribution Methods in the Social Sciences, Springer-Verlag, Inc., New York, 1999 ISBN 0387987789

Examples


# Calculate the gini correlation between the salary and total income distributions


Salary_distribution = sample_income_data$wage
Total_income_distribution = rowSums(sample_income_data[3:6])

gini_corr(Salary_distribution, Total_income_distribution)



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 :

Usage

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

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.

Value

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

Examples


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)

Gini income elasticity

Description

This function computes the elasticity of Gini index associated with a percentage change in the mean income (for each income source). It provides a set of indicators :

Usage

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

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.

Value

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

Examples


sample_income_data %>%
  gini_income_elasticity(wage, self_employment_rev, farming_rev, other_rev,
  .by = region)

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

Sample income data

Description

A simulated data for households income sources

Usage

sample_income_data

Format

A data frame with 200 rows and 6 columns:

region

Whether the households residence is urban or rural

sample_wgt

Sample weight

wage

Wage and salary

self_employment_rev

Earnings from self-employment

farming_rev

Income derived from agricultural activities

other_rev

Other income sources

...


Growth-redistribution impacts on social welfare function.

Description

This function provides a Growth-redistribution decomposition of effects (for each income source) on social welfare function defined by Amartya Sen (1970, ISBN:978-0-444-85127-7).

Usage

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

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.

Details

It provides a set of indicators :

Value

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

Examples


sample_income_data %>%
  social_welfare_impact(wage, self_employment_rev, farming_rev, other_rev,
  .wgt = sample_wgt)

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