fginindex {giniVarCI} | R Documentation |
Gini index for finite populations and different estimation methods.
Description
Estimates the Gini index in finite populations, using different methods.
Usage
fginindex(
y,
w,
method = 2L,
Pi = NULL,
na.rm = TRUE,
useRcpp = TRUE
)
Arguments
y |
A vector with the non-negative real numbers to be used for estimating the Gini index. |
w |
A numeric vector with the survey weights to be used for estimating the Gini index. This argument can be missing if argument |
method |
An integer between 1 and 5 selecting one of the 5 methods detailed below for estimating the Gini index in finite populations. The default method is |
Pi |
A numeric vector with the (sample) first inclusion probabilites to be used for estimating the Gini index. This argument can be |
na.rm |
A 'TRUE/FALSE' logical value indicating whether |
useRcpp |
A 'TRUE/FALSE' logical value indicating whether |
Details
For a sample , with size
and inclusion probabilities
(argument
Pi
), derived from a finite population , with size
, different formulations of the Gini index have been proposed in the literature. This function estimates the Gini index using various formulations, and both
R
and C++
codes are implemented. This can be useful for research purposes, and speed comparisons can be made. The different methods for estimating the Gini index are (see also Muñoz et al., 2023):
method = 1
(Langel and Tillé, 2013)
where ,
, and
are the survey weights. For example, the survey weights can be
.
w
or Pi
must be provided, but not both. It is required that , for
, when both
w
and Pi
are provided.
method = 2
(Alfons and Templ, 2012; Langel and Tillé, 2013)
where are the values
sorted in increasing order,
are the values
sorted according to the increasing order of the values
, and
. Langel and Tillé (2013) show that
.
method = 3
(Berger, 2008)
where
is the smooth (mid-point) distribution function, and is the indicator variable that takes the value 1 when its argument is true, and the value 0 otherwise. It can be seen that
.
method = 4
(Berger and Gedik-Balay, 2020)
where and
method = 5
(Lerman and Yitzhaki, 1989)
where
and .
Value
A single numeric value between 0 and 1. The estimation of the Gini index.
Author(s)
Juan F Munoz jfmunoz@ugr.es
Jose M Pavia pavia@uv.es
Encarnacion Alvarez encarniav@ugr.es
References
Alfons, A., and Templ, M. (2012). Estimation of social exclusion indicators from complex surveys: The R package laeken. KU Leuven, Faculty of Business and Economics Working Paper.
Berger, Y. G. (2008). A note on the asymptotic equivalence of jackknife and linearization variance estimation for the Gini Coefficient. Journal of Official Statistics, 24(4), 541-555.
Berger, Y. G., and Gedik-Balay, İ. (2020). Confidence intervals of Gini coefficient under unequal probability sampling. Journal of official statistics, 36(2), 237-249.
Langel, M., and Tillé, Y. (2013). Variance estimation of the Gini index: revisiting a result several times published. Journal of the Royal Statistical Society: Series A (Statistics in Society), 176(2), 521-540.
Lerman, R. I., and Yitzhaki, S. (1989). Improving the accuracy of estimates of Gini coefficients. Journal of econometrics, 42(1), 43-47.
Muñoz, J. F., Moya-Fernández, P. J., and Álvarez-Verdejo, E. (2023). Exploring and Correcting the Bias in the Estimation of the Gini Measure of Inequality. Sociological Methods & Research. https://doi.org/10.1177/00491241231176847
See Also
Examples
# Income and weights (region "Burgenland") from the 2006 Austrian EU-SILC (Package 'laeken').
data(eusilc, package="laeken")
y <- eusilc$eqIncome[eusilc$db040 == "Burgenland"]
w <- eusilc$rb050[eusilc$db040 == "Burgenland"]
#Comparing the computation time for the various estimation methods and using R
microbenchmark::microbenchmark(
fginindex(y, w, method = 1L, useRcpp = FALSE),
fginindex(y, w, method = 2L, useRcpp = FALSE),
fginindex(y, w, method = 3L, useRcpp = FALSE),
fginindex(y, w, method = 4L, useRcpp = FALSE),
fginindex(y, w, method = 5L, useRcpp = FALSE)
)
# Comparing the computation time for the various estimation methods and using Rcpp
microbenchmark::microbenchmark(
fginindex(y, w, method = 1L),
fginindex(y, w, method = 2L),
fginindex(y, w, method = 3L),
fginindex(y, w, method = 4L),
fginindex(y, w, method = 5L)
)
# Estimation of the Gini index using 'method = 4'.
y <- c(30428.83, 14976.54, 18094.09, 29476.79, 20381.93, 6876.17,
10360.96, 8239.82, 29476.79, 32230.71)
w <- c(357.86, 480.99, 480.99, 476.01, 498.58, 498.58, 476, 498.58, 476.01, 476.01)
fginindex(y, w, method = 4L)