Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Calculating p20/p80 indicator with weights
From
<[email protected]>
To
<[email protected]>
Subject
st: Calculating p20/p80 indicator with weights
Date
Tue, 19 Jun 2012 09:34:33 +0100
------------------------------
Date: Mon, 18 Jun 2012 15:35:10 +0200
From: Anke Weber <[email protected]>
Subject: st: Calculating p20/p80 indicator with weights
This is a multi-part message in MIME format.
- --Boundary_(ID_igLNjvdU/u4kFxt69BxbMA)
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
Dear all,
I am using Stata 11, and trying to take into account pweights when
constructing the p20/p80 inequality measure, i.e. the ratio of the
average income of the richest 20 percent of the population divided by
the average income of the bottom 20 percent (using data from the SOEP,
USS, and EUSILC databases). Would anyone have a suggestion on how to
account for the sampling weight (of the person) in the data? So far, I
explored the ineqdeco command, which let's you use aweights but
unfortunately there is only an p75/p25 or p90/p10 measure. Then, I tried
to use the svy command to calculate separately the 20-percentile and the
80 percentile, using my equivalised income variable (equivincome) but
this did not work either:
svyset pidp [pweight=a_psnenus_xw]
pweight: a_psnenus_xw
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: pidp
FPC 1: <zero>
svy: egen p20= pctile(equivincome), p(20)
egen is not supported by svy with vce(linearized); see help svy
estimation for a list of
Stata estimation commands that are supported by svy
I would be very happy if some one has an idea of how to calculate the
p20/p80 indicator with weights!
Many thanks in advance,
Anke
++++++++++++++++++++++++++++++++++++++
There are many solutions. Perhaps the easiest is to use -sumdist- (from
SSC). See also -svylorenz- (SSC). Example below.
. sysuse auto
(1978 Automobile Data)
. sumdist price [w=weight], n(5)
(analytic weights assumed)
Distributional summary statistics, 5 quantile groups
------------------------------------------------------------------------
---
Quantile |
group | Quantile % of median Share, % L(p), %
GL(p)
----------+-------------------------------------------------------------
---
1 | 4181.000 80.574 12.162 12.162
798.896
2 | 4749.000 91.521 13.632 25.794
1694.304
3 | 5798.000 111.736 16.461 42.255
2775.571
4 | 9690.000 186.741 21.242 63.497
4170.884
5 | 36.503 100.000
6568.637
------------------------------------------------------------------------
---
Share = quantile group share of total price;
L(p)=cumulative group share; GL(p)=L(p)*mean(price)
. ret list
scalars:
r(gl5) = 6568.636904761905
r(cush5) = 1
r(sh5) = .3650305213361488
r(qrel4) = 1.867411832723068
r(q4) = 9690
r(gl4) = 4170.883950948801
r(cush4) = .6349694786638513
r(sh4) = .2124204338931906
r(qrel3) = 1.117363653883215
r(q3) = 5798
r(gl3) = 2775.571249552452
r(cush3) = .4225490447706607
r(sh3) = .164610561137709
r(qrel2) = .9152052418577761
r(q2) = 4749
r(gl2) = 1694.304242749731
r(cush2) = .2579384836329517
r(sh2) = .1363156666281005
r(qrel1) = .8057429177105415
r(q1) = 4181
r(gl1) = 798.8961242391694
r(cush1) = .1216228170048512
r(sh1) = .1216228170048512
r(ngps) = 5
r(p95) = 13594
r(p90) = 11995
r(p75) = 7827
r(p50) = 5189
r(p25) = 4424
r(p10) = 3955
r(p5) = 3798
r(median) = 5189
r(N) = 74
r(sum_w) = 223440
r(mean) = 6568.636904761905
matrices:
r(relquantiles) : 1 x 4
r(shares) : 1 x 5
r(quantiles) : 1 x 4
. di "Ratio of income share of richest 20% to poorest 20% = "
r(sh5)/r(sh1)
Ratio of income share of richest 20% to poorest 20% = 3.0013326
++++++++++++++++++++++++++++++++++++++
NB Anke: please ensure that your email software sends plain text (ASCII)
messages to Statalist.
Stephen
------------------
Professor Stephen P. Jenkins <[email protected]>
Department of Social Policy and STICERD
London School of Economics and Political Science
Houghton Street, London WC2A 2AE, UK
Tel: +44(0)20 7955 6527
Changing Fortunes: Income Mobility and Poverty Dynamics in Britain, OUP
2011, http://ukcatalogue.oup.com/product/9780199226436.do
Survival Analysis Using Stata:
http://www.iser.essex.ac.uk/survival-analysis
Downloadable papers and software: http://ideas.repec.org/e/pje7.html
Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/