# Gini coefficient and error bounds

I have a time series of data with N=14 counts at each time point, and I want to calculate the Gini coefficient and a standard error for this estimate at each time point.

Since I have only N=14 counts at each time point I proceeded by calculating the jackknife variance, i.e. $\operatorname{var}(G) = \frac{n-1}{n} \times \sum_{k=1}^n (G(n,k)-\bar{G}(n))^2$ from equation 7 of Tomson Ogwang 'A convenient method of computing the Gini index and its' standard error'. Where $G(n,k)$ is the Gini coefficient of the N values without element $k$ and $\bar{G}(x)$ is the mean of the $G(n,k)$.

Direct naive implementation of the above formula for Variance.

calc.Gini.variance <- function(x) {
N <- length(x)
# using jacknifing as suggested by Tomson Ogwang - equation 7
# in the Oxford Bulletin of Economics and Statistics, 62, 1 (2000)
# ((n-1)/n) \times \sum_{k=1}^n (G(n,k)-\bar{G}(n))^2
gini.bar <- Gini(x)

gini.tmp <- vector(mode='numeric', length=N)
for (k in 1:N) {
gini.tmp[k] <- Gini(x[-k])
}
gini.bar <- mean(gini.tmp)
sum((gini.tmp-gini.bar)^2)*(N-1)/N
}
calc.Gini.variance(c(1,2,2,3,4,99))
# [1] 0.1696173
Gini(c(1,2,2,3,4,99))
# [1] 0.7462462

Is this a reasonable approach for a small N? Any other suggestions?

• Maybe you can add the actual calculations you're using for both the sample estimate and the standard error since many people may not have access to the paper at the link provided. – cardinal Jan 28 '12 at 16:56

One problem will be that with this small sample size and a complex statistic (gini coefficient) the probability distribution of your statistic will certainly not be approximately normal, so the "standard error" may be misleading if you intend to use it to create confidence intervals or hypothesis testing relying on normality.

I would have thought a percentile bootstrap would be a better method, and simpler to implement. For example:

> library(reldist) # just for the gini() function
> library(boot) # for the boot() function
> x <- c(1,2,2,3,4,99)
> gini(x)
[1] 0.7462462 # check get same result as in your question
> y <- boot(x, gini, 500)
> quantile(y$t, probs=c(0.025, 0.975)) 2.5% 97.5% 0.6353158 0.7717868 > plot(density(y$t))

I haven't attached the plot generated by the end but it shows that the confidence interval is very assymetric, so using a method like +/- 1.96*se for a confidence interval will be misleading. I'm not a fan of jackknife methods for confidence intervals mainly for this reason; jackknife was invented as a bias reduction technique for point estimates, whereas confidence intervals are intrinsic to the whole idea of the bootstrap.

• This is in fact one of the points of the original paper -- the method is developed to ~relieve the computational burden of using jackknife to calculate Gini SEs. With $N = 14$, there's hardly any burden at all. – MichaelChirico Nov 30 '18 at 7:41