Title: | Inequality Joint Decomposition |
---|---|
Description: | Computes and decomposes Gini, Bonferroni and Zenga 2007 point and synthetic concentration indexes. Decompositions are intended: by sources, by subpopulations and by sources and subpopulations jointly. References, Zenga M. M.(2007) <doi:10.1400/209575> Zenga M. (2015) <doi:10.1400/246627> Zenga M., Valli I. (2017) <doi:10.26350/999999_000005> Zenga M., Valli I. (2018) <doi:10.26350/999999_000011>. |
Authors: | Alberto Arcagni [aut, cre], Igor Valli [aut], Michele Zenga [ctb] |
Maintainer: | Alberto Arcagni <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0 |
Built: | 2025-02-14 03:40:04 UTC |
Source: | https://github.com/cran/ineqJD |
Computes the decomposition of the Bonferroni point inequality indexes of a statistical variable described in the object
x
.
bonferroni(x)
bonferroni(x)
x |
An object of class |
bonferroni
computes the decomposition of the Bonferroni point inequality indexes from the object x
of class "dataProcessed"
. x
is usually the result of dataProcessing
function.
index |
String denoting computed index. |
decomposition |
Array containing the decompositions. The dimensions of |
x |
Object of class |
Alberto Arcagni, Igor Valli.
Zenga M., Valli I. (2017). Joint decomposition by Subpopulations and Sources of the Point and Synthetic Bonferroni Inequality Measures. Statistics and Applications, XV (2), pp. 83-120.
gini
and zenga
for other inequality indexes and dataProcessing
for the class "dataProcessed"
.
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- bonferroni(x) decomposition
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- bonferroni(x) decomposition
Convert raw data to frequency distribution framework and returns cumulative sums.
dataProcessing( units, groups = rep("G1", nrow(as.matrix(units))), weights = rep(1, nrow(as.matrix(units))) )
dataProcessing( units, groups = rep("G1", nrow(as.matrix(units))), weights = rep(1, nrow(as.matrix(units))) )
units |
Numeric vector of length |
groups |
Vector of length |
weights |
Vector of lweights of length |
dataProcessing
convert raw data in the frequency distribution framework with r
distinct values of . In this way repeated values are removed as well as ordering issues. Moreover cumulative frequencies and cumulative sources values are evaluated in order to prepare data for inequality decompositions.
yh |
Vector of length |
Phl |
Matrix of absolute cumulative frequencies of dimension |
Qhlk |
Array of cumulative sum of sources of dimension |
Alberto Arcagni, Igor Valli
Zenga M.M. (2007). Inequality curve and inequality index based on the ratios between lower and upper means. Statistica and Applicazioni, V(1), 3-27
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( units = data[, c('X1', 'X2')], groups = data[, 'G'], ) x
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( units = data[, c('X1', 'X2')], groups = data[, 'G'], ) x
Computes point and synthetic Gini indexes on a variable .
gini(x)
gini(x)
x |
List containing: |
gini
compute point and synthetic Gini indexes on a variable y
, e.g. income, on a statistical population that could be partitioned in g
subpopultions and could be considered as sum of c
sources, e.g. income sources.
index |
String denoting computed index. |
decomposition |
array containing the decompositions. |
x |
object usually of class |
Alberto Arcagni, Igor Valli.
Zenga M., Valli I. (2018). Joint decomposition by Subpopulations and Sources of the Point and Synthetic Gini Indexes. Statistics and Applications, XVI (1).
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- gini(x) decomposition
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- gini(x) decomposition
Generates step-functions (see stepfun
) representing inequality curves or sources/subpopulations point contributions in the decomposition x
generated by functions gini
, bonferroni
or zenga
.
inequalityCurves(x, ...) ## S3 method for class 'decomposition' inequalityCurves(x, l = 1:dim(x$decomposition)[2], k = 1:dim(x$decomposition)[4], ...)
inequalityCurves(x, ...) ## S3 method for class 'decomposition' inequalityCurves(x, l = 1:dim(x$decomposition)[2], k = 1:dim(x$decomposition)[4], ...)
x |
An object of class |
l |
Vector of selected subpopulations. If only one subpopulation is selected the resulting step function provides its point contributions. More than one subpopulation can be selected and contributions are cumulated. If empty all subpopulations are considered and contributions are marginalized by subpopulations. |
k |
Vector of selected sources. If only one source is selected the resulting step function provides its point contributions. More than one source can be selected and contributions are cumulated. If empty all sources are considered and contributions are marginalized by sources. |
... |
Potentially further arguments (required by the generic). |
By default generates step functions representing inequality curves of the whole population. If arguments l
and/or k
are defined, resuts are step functions representing point contributions of the selected subpopulations and/or sources.
The class of the result is "inequality_curves"
that is associated to the method plot.inequality_curves
for graphical representations. Such derived class hinerits the features of the "stepfun"
class.
An object of class "inequality_curves"
hineriting the features of class "stepfun"
with the following additional attributes:
index |
String denoting computed index. |
min , max
|
The range of values assumed by the function. |
groups |
Vector of names of the subpopulations partitioning the whole population . |
sources |
Vector of names of the all the sources that sum to the total variable |
selected_groups |
Vector of names of the selected subpopulations to evaluate the point contributions. |
selected_sources |
Vector of names of the selected sources to evaluate the point contributions. |
Alberto Arcagni, Igor Valli
Zenga M. M.(2007). Inequality Curve and Inequality Index based on the Ratios between llower and upper Means . Statistica and Applicazioni, V (1), 3-27.
Zenga M. (2015) Joint decomposition by subpopulations and sources of the point and synthetic Zenga(2007) Index I(Y). Statistica and Applicazioni, XIII (2), pp.163-195.
Zenga M., Valli I. (2017). Joint decomposition by Subpopulations and Sources of the Point and Synthetic Bonferroni Inequality Measures. Statistics and Applications, XV (2), pp. 83-120.
Zenga M., Valli I. (2018). Joint decomposition by Subpopulations and Sources of the Point and Synthetic Gini Indexes. Statistics and Applications, XVI (1).
See gini
, bonferroni
, zenga
to obtain objects of class decomposition
and see plot.inequality_curves
for the graphical representation.
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- zenga(x) ic <- inequalityCurves(decomposition) ic contrib1 <- inequalityCurves(decomposition, l = 1) contrib1 contrib12 <- inequalityCurves(decomposition, l = 1:2) contrib12
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- zenga(x) ic <- inequalityCurves(decomposition) ic contrib1 <- inequalityCurves(decomposition, l = 1) contrib1 contrib12 <- inequalityCurves(decomposition, l = 1:2) contrib12
Method of the generic plot
for objects generated by the function inequalityCurves
.
## S3 method for class 'inequality_curves' plot( x, pch = 16, from = 0, to = 1, xlim = NULL, ylim = NULL, xaxs = "i", yaxs = "i", xlab = "p", ylab = NULL, main = attributes(x)$index, sub = paste0( "grp: ", paste(attributes(x)$groups, collapse = ", "), "; src: ", paste(attributes(x)$sources, collapse = ", ") ), ... )
## S3 method for class 'inequality_curves' plot( x, pch = 16, from = 0, to = 1, xlim = NULL, ylim = NULL, xaxs = "i", yaxs = "i", xlab = "p", ylab = NULL, main = attributes(x)$index, sub = paste0( "grp: ", paste(attributes(x)$groups, collapse = ", "), "; src: ", paste(attributes(x)$sources, collapse = ", ") ), ... )
x |
Object of class |
pch |
A vector of plotting characters or symbols: see |
from , to
|
The range over which the function will be plotted. |
xlim |
The x limits (x1, x2) of the plot. The default value, |
ylim |
the y limits of the plot. |
xaxs |
The style of axis interval calculation to be used for the x-axis. See |
yaxs |
The style of axis interval calculation to be used for the y-axis. See |
xlab |
a title for the x axis: see |
ylab |
a title for the y axis: see |
main |
an overall title for the plot: see |
sub |
a sub title for the plot: see |
... |
Arguments to be passed to methods, such as |
This method is a convenience wrapper for plotting inequality curves. Default values of the plot
are modified in order to plot inequality curves in the unitary square. Moreover, the default value of the argument sub
shows in the plot if the curve represents the whole inequality or a contribution.
The same output of the function plot.stepfun
, a list with two components:
t |
abscissa (x) values, including the two outermost ones. |
y |
y values ‘in between’ the |
Alberto Arcagni, Igor Valli
Zenga M. M.(2007). Inequality Curve and Inequality Index based on the Ratios between llower and upper Means . Statistica and Applicazioni, V (1), 3-27.
Zenga M. (2015) Joint decomposition by subpopulations and sources of the point and synthetic Zenga(2007) Index I(Y). Statistica and Applicazioni, XIII (2), pp.163-195.
Zenga M., Valli I. (2017). Joint decomposition by Subpopulations and Sources of the Point and Synthetic Bonferroni Inequality Measures. Statistics and Applications, XV (2), pp. 83-120.
Zenga M., Valli I. (2018). Joint decomposition by Subpopulations and Sources of the Point and Synthetic Gini Indexes. Statistics and Applications, XVI (1).
plot
, graphical parameters
, par
, plot.stepfun
, inequalityCurves
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- zenga(x) ic <- inequalityCurves(decomposition) contrib1 <- inequalityCurves(decomposition, l = 1) contrib12 <- inequalityCurves(decomposition, l = 1:2) plot(ic) plot(contrib1, add = TRUE) plot(contrib12, add = TRUE) text(0.1, 1/6+0:2/3, labels = c("G1", "G2", "G3"))
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- zenga(x) ic <- inequalityCurves(decomposition) contrib1 <- inequalityCurves(decomposition, l = 1) contrib12 <- inequalityCurves(decomposition, l = 1:2) plot(ic) plot(contrib1, add = TRUE) plot(contrib12, add = TRUE) text(0.1, 1/6+0:2/3, labels = c("G1", "G2", "G3"))
summary
method for class "decomposition"
.
## S3 method for class 'decomposition' summary(object, ...) ## S3 method for class 'summary.decomposition' print(x, ...)
## S3 method for class 'decomposition' summary(object, ...) ## S3 method for class 'summary.decomposition' print(x, ...)
object |
An object of class |
x |
rtrtrt |
... |
further arguments passed to or from other methods. |
summary.decomposition
method use
index |
String denoting computed index. |
joint |
Array of joint decompositions by sources and subpopulations. |
pairs |
Matrix of decompositions by subpopulations. |
within |
Vector of |
between |
Vector of |
groups |
Vector of subpopulations contribution to the overall inequality. |
groups_sources |
Matrix of subpopulations contributions for each source to the overall inequality. |
sources |
Vector of sources contribution to the overall inequality. |
synthetic |
Scalar denoting the value of the synthetic index. |
Alberto Arcagni, Igor Valli.
Zenga M. M.(2007). Inequality Curve and Inequality Index based on the Ratios between llower and upper Means . Statistica and Applicazioni, V (1), 3-27.
Zenga M. (2015) Joint decomposition by subpopulations and sources of the point and synthetic Zenga(2007) Index I(Y). Statistica and Applicazioni, XIII (2), pp.163-195.
Zenga M., Valli I. (2017). Joint decomposition by Subpopulations and Sources of the Point and Synthetic Bonferroni Inequality Measures. Statistics and Applications, XV (2), pp. 83-120.
Zenga M., Valli I. (2018). Joint decomposition by Subpopulations and Sources of the Point and Synthetic Gini Indexes. Statistics and Applications, XVI (1).
gini
, bonferroni
, zenga
, dataProcessing
.
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- zenga(x) summary(decomposition)
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- zenga(x) summary(decomposition)
Computes point and synthetic Zenga 2007 indexes on a variable .
zenga(x)
zenga(x)
x |
List containing: |
zenga
compute point and synthetic Zenga 2007 indexes on a variable y
, e.g. income, on a statistical population that could be partitioned in g
subpopultions and could be considered as sum of c
sources, e.g. income sources.
index |
String denoting computed index. |
decomposition |
Array containing the decompositions. |
x |
Object usually of class |
Alberto Arcagni, Igor Valli
Zenga M. M.(2007). Inequality Curve and Inequality Index based on the Ratios between lower and upper means . Statistica and Applicazioni, V (1), 3-27.
Zenga M. (2015) Joint decomposition by subpopulations and sources of the point and synthetic Zenga(2007) Index I(Y). Statistica and Applicazioni, XIII (2), pp.163-195.
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- zenga(x) decomposition
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source data <- data.frame(G, X1, X2) # no sample weights are considered x <- dataProcessing( # data preparation units = data[, c('X1', 'X2')], groups = data[, 'G'], ) decomposition <- zenga(x) decomposition