Estimates the Gini index in finite populations, using different methods.
fginindex(
y,
w,
method = 2L,
Pi = NULL,
na.rm = TRUE,
useRcpp = TRUE
)
A single numeric value between 0 and 1. The estimation of the Gini index.
A vector with the non-negative real numbers to be used for estimating the Gini index.
A numeric vector with the survey weights to be used for estimating the Gini index. This argument can be missing if argument Pi
is provided.
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 method = 2L
.
A numeric vector with the (sample) first inclusion probabilites to be used for estimating the Gini index. This argument can be NULL
if argument w
is provided. The default value is Pi = NULL
.
A `TRUE/FALSE` logical value indicating whether NA
's should be removed before the computation proceeds. The default value is na.rm = TRUE
.
A `TRUE/FALSE` logical value indicating whether Rcpp
(useRcpp = TRUE
), or R
(useRcpp = FALSE
), is used for computation. The default value is UseRcpp = TRUE
.
Juan F Munoz jfmunoz@ugr.es
Jose M Pavia pavia@uv.es
Encarnacion Alvarez encarniav@ugr.es
For a sample Pi
), derived from a finite population 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)
w
or Pi
must be provided, but not both. It is required that w
and Pi
are provided.
method = 2
(Alfons and Templ, 2012; Langel and Tillé, 2013)
method = 3
(Berger, 2008)
method = 4
(Berger and Gedik-Balay, 2020)
method = 5
(Lerman and Yitzhaki, 1989)
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
fgini
, fcompareCI
# 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)
Run the code above in your browser using DataLab