I wanted to compute some gini coefficients for different populations of differents sizes. In R I used the ineq package containing a Gini coefficient implementation. One of the paramater (i.e. corr)
corr (logical). Argument of the function Gini specifying whether or not a finite sample correction should be applied.
Here's the code of the function. If corr=TRUE
then we enter into the if
and the gini coefficient is divided by the size of the population -1 . Could someone explain me when and why this correction is important ?
function (x, corr = FALSE, na.rm = TRUE)
{
if (!na.rm && any(is.na(x)))
return(NA_real_)
x <- as.numeric(na.omit(x))
n <- length(x)
x <- sort(x)
G <- sum(x * 1L:n)
G <- 2 * G/sum(x) - (n + 1L)
if (corr)
G/(n - 1L)
else G/n
}