I want to calculate confidence intervals for a gini coefficient and I tried to apply the boot() function shown below for that purpose (as suggested here):
library(reldist) # just for the gini() function
library(boot) # for the boot() function
x <- c(1,2,2,3,4,99)
gini(x)
y <- boot(x, gini, 500)
quantile(y$t, probs=c(0.025, 0.975))
It works perfectly fine in this example. But when I try to apply it on my actual data I receive a warning ( "In sum(weights) : integer overflow - use sum(as.numeric(.))" ) and the function doesn't work. Instead of the quantile I receive an error: " Error in quantile.default(y2$t, probs = c(0.025, 0.975)) : missing values and NaN's not allowed if 'na.rm' is FALSE"
I am not entirely sure whether the integer overflow warning and this error are related but I guess so. I read several posts on integer overflow (for example this one) and downloaded the Rmpfr package (as suggested here). Without a very clear understanding of what's happening I tried to enter x as a mpfr object but it didn't work. Also, my variable is numeric so simply using as.numeric conversion (as suggested here) is also not the solution.
Is there an alternative way to calculate error bounds for gini, or a solution to this problem?