[R] Bootstrapping with weighted data sample

Salvatore Barbaro barbaro at uni-mainz.de
Mon Sep 27 18:03:23 CEST 2004

Hi all!

Consider a sample, x, like this:
x<- matrix(rbind(4,8,0,2, 25,30,5,32), ncol=2)

Weight  Income
4    25
8    30
0    5
2    32

Here the "Weight" assigns the weight of each observation. It is easy to 
compute any measure of inequality, for instance

Gini(rep(x[,2], x[,1]))

However, what happens is that the original sample is extended (from four 
observations to 14 (sum(x[,1]) instead of length(x[,1])). The problem I 
have arises when I try to compute a confidence interval surrounding this 
Gini coefficient via bootstrap, because the bootstrap-sample should of 
course not exceed the number of observations.

Has anybody an idea or experience with such a problem.

Thanks in advance.

P.S. I am using library(bootstrap) with bcanon() to obtain boostrap 
confidence intervals.


More information about the R-help mailing list