Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: new ineqdeco - capturing results for dynamic decomposition

From   "Stephen P. Jenkins" <[email protected]>
To   [email protected]
Subject   st: new ineqdeco - capturing results for dynamic decomposition
Date   Sat, 9 Sep 2006 09:05:39 +0100 (BST)

The new version of -ineqdeco- on SSC is working fine, as far as I know. The
extended set of saved results was provided explicitly in order to facilitate
calculations of Mookherjee & Shorrocks--type decompositions of changes of
inequality in mind.

You were almost there. The problem is in your code.

The line

         replace GE92=r(ge0_r) if var==`r'

should be

         replace GE92=r(ge0_`r') if var==`r'

and similarly in later lines as well.

Note also that macro r(levels) is left behind after -ineqdeco-, precisely to
facilitate the sort of post-calculation looping that you are doing.

You could also loop over r(levels) directly rather than local S, unless of course
you had already just created  local S from r(levels) and have simply not shown us

It is important to use -foreach- as you did, rather than -forvalues- (say), because
-ineqdeco- requires the values of the bygroup variable to be non-negative integers
but they might be non-consecutive integers. r(levels) contains the values of the
bygroup that were actually used in your -ineqdeco, by(bygroup)- command.

> Date: Fri, 8 Sep 2006 10:20:26 -0700 (PDT)
> From: Brian Sartene <[email protected]>
> Subject: st: new ineqdeco - capturing results for dynamic decomposition
> Dear all:
> I would like to use the new version of Ineqdeco to
> write a program for the dynamic decomposition of the
> GE(0) measure. however, i have two problems.
> First, i have trouble retrieving subgroup-level
> results.
> i am trying the code given below but it is not
> capturing the r(ge0_k) results.
> Second, using the Mookherjee and Shorrocks formulation
> of the decomposition, I can see a need for all the
> subgroup components except the subgroup sum of
> weights.
> I wondered if this is needed for the decomposition, or
> is given for another purpose.
> Thank you in advance.
> Regards,
> Brian
> egen var=group(comu)
> levels7 var, local (S)
> ineqdeco hhed [w=expc] if year==1992, by (var)
> tempvar GE92 popsh92 relmean92 incsh92 loginc92 GE03
> popsh03 relmean03 incsh03 loginc03 weight92 weight03
> lnlambda92 lnlambda03
> foreach r of local S {
> replace GE92=r(ge0_r) if var==`r'
> replace popsh92 = r(v_r) if var==`r'
> replace relmean92=r(lambda_r) if var==`r'
> replace incsh92=r(theta_r) if var==`r'
> replace loginc92=r(lgmean_r) if var==`r'
> replace weight92=r(sumw_r) if var==`r'
> replace lnlambda92=ln(relmean92) if var==`r'
> }

Professor Stephen P. Jenkins <[email protected]>
Institute for Social and Economic Research
University of Essex, Colchester CO4 3SQ, U.K.
Tel: +44 1206 873374.  Fax: +44 1206 873151.
Survival Analysis using Stata:

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index