Bookmark and Share

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]

Re: st: calculating income deprivation in stata,


From   Mike Lacy <[email protected]>
To   [email protected]
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
<[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index