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: xtile creating different deciles using same data
From
"Alvaro Herrera E." <[email protected]>
To
[email protected]
Subject
st: xtile creating different deciles using same data
Date
Mon, 2 Jan 2012 15:42:39 -0300
Hi, I am using the command xtile on stata 11, 32bits, to create income
deciles on my database, but I found an inconsistency:
I have a variable with the household per capita income, with data for the
whole population. Then I create deciles, but I don't do it over the
population, but households.
To do so, I use only one observation per household (they all share the
same household per capita income) to create my deciles, and then I assign
the rest of the household members to the decile of such observations.
Of course, as poorer families tend to be larger, I end up with deciles that
have more than 10% of the population on the lower end of the distribution,
and others with less than 10% on the other end. That's fine with me.
basically, what I do is
xtile decaux==income if count==1 [w=weight], nq(10) where
count==1 is the first member-chosen randomly- of each household, and
then
recode decaux .=0
by id_househ: egen decile=sum(decaux) I
assign the other members of each household to the deciles of their
respective members (count==1)
The problem is that if I run the same commands on the same database for a
second time (or a third, or fourth, always without modifying the data),
then the number of observations assigned to each decile differs every time.
The overall population does not change, but the population assigned to the
deciles changes marginally every time.
Any ideas?
thanks!
--
______________
Alvaro Herrera E.
Phd (C) in Economics
University of Sussex
UNITED KINGDOM
*
* 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/