-2

I would like to compute in R how much the one percent wealthier concentrates. For example, maybe it is the case that the one percent wealthier concentrates 33% of total wealth in the country.

I have a survey dataset with the variables:

  • asset: Value of total assets for each individual (row);
  • wgt : Sample weight associated with each individual (row).

What is the best way to compute this concentration measure?

Thanks a lot!

Diego
  • 33
  • 1
  • 2
    Please see: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example . – nico Jul 05 '14 at 14:46
  • 1
    meh you all are too tough on him. :) this question has a pretty straightforward programmatic answer for those of us familiar with the `survey` package – Anthony Damico Jul 05 '14 at 20:35

1 Answers1

3

welcome to SO. please don't be discouraged by the downvoters, i think your question is perfectly reasonable. let's say your survey design object is scf.design .. that way, you could try a test case using the survey of consumer finances

# compute the cutoff point for the top percentile
y <- coef( svyquantile( ~ asset , scf.design , 0.99 ) )
# for this, you probably don't need the standard error, 
# so immediately just extract the coefficient (the actual number)
# and discard the standard error term by using the `coef` function
# around the `svyquantile` call

# create a new flag in your survey design object
# that's a 1 if the individual is in the top percentile
# and a 0 for everybody else
scf.design <- update( scf.design , onepct = as.numeric( asset > y ) )

# calculate the aggregate of all assets
# held by the top percentile
# and also held by everybody else
svyby( ~asset , ~onepct , scf.design , svytotal )

# or, if you like, calculate them separately
svytotal( ~asset , subset( scf.design , onepct == 1 ) )

svytotal( ~asset , subset( scf.design , onepct == 0 ) )

# and divide each of those numbers by all assets
# held by everybody
svytotal( ~asset , scf.design )
Anthony Damico
  • 5,779
  • 7
  • 46
  • 77
  • Thanks Anthony! I am the guy who sent you an email about the Gini coefficient with the SCF. I will try your solution. – Diego Jul 06 '14 at 15:09