Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: calculating income deprivation in stata,


From   Mike Lacy <Michael.Lacy@colostate.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: calculating income deprivation in stata,
Date   Sat, 28 Aug 2010 13:52:13 -0600


On Sat, Aug 28, 2010 at 6:31 AM, Dimitrije Ti?ma
<dimitrijetisma@gmail.com> wrote:

>...snip, snip
>Namely, I want to construct a variable called income deprivation
>score. Each individual A in the dataset would be assigned a score that
>is the sum of all income differentials between individual A and all
>other individuals who have a higher income than individual A. Do you
>know of any Stata code that can help?

While fully acknowledging Stas Kolenikov's point about the resemblance
of the preceding to the Gini index, I'll offer a snippet for the requested calculation,
if I understand correctly:

// example data
clear *
set seed 39467
set obs 10
gen id = _n
gen income = trunc(40 * runiform())
//
gsort -income
gen deviation = sum(income[_n-1]) - ((_n-1) * income)
list

Regards,


=-=-=-=-=-=-=-=-=-=-=-=-=
Mike Lacy
Fort Collins CO USA
(970) 491-6721 office







*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index