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: how to code results from ineqdeco into new variable


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: how to code results from ineqdeco into new variable
Date   Sat, 17 Nov 2012 17:30:15 +0000

. findit ineqdeco

points to the version on SSC which I already mentioned. Note that this
underlines the advice longstanding in the FAQ to explain _where_ you
obtained user-written programs.

Nick

On Sat, Nov 17, 2012 at 4:16 PM, Megan Sheahan <[email protected]> wrote:
> Looks like a fairly old version:
>
> . which ineqdeco
> c:\ado\plus\i\ineqdeco.ado
> *! version 1.0.1 Stephen P. Jenkins, April 1998   STB-48 sg104
> *! Inequality indices and decomposition by population subgroups
> *! Syntax: ineqdeco <var> [[w=weight] if <exp> in <range>],
> *!              [by(<groupvar>) w s]
>
> How would I go about finding a newer one? I just downloaded the first
> one that came up.
>
> Thanks for all of your help and patience.
>
> All the best,
> Megan
>
>
> On Sat, Nov 17, 2012 at 3:37 AM, Nick Cox <[email protected]> wrote:
>> I can't see what the problem is then. Please confirm the version of
>> -ineqdeco- you are using by
>>
>> . which ineqdeco
>>
>> Nick
>>
>> On Sat, Nov 17, 2012 at 12:20 AM, Megan Sheahan <[email protected]> wrote:
>>> "vil" is a double numeric variable; "totasvalall_10" is a long numeric
>>> variable.
>>>
>>>
>>> On Fri, Nov 16, 2012 at 6:02 PM, Nick Cox <[email protected]> wrote:
>>>> -ineqdeco- is from SSC.
>>>>
>>>> Works for me:
>>>>
>>>> . sysuse auto, clear
>>>> (1978 Automobile Data)
>>>>
>>>> . qui ineqdeco mpg, by(rep78)
>>>>
>>>> . gen gini = .
>>>> (74 missing values generated)
>>>>
>>>> . qui foreach v in 1 2 3 4 5 {
>>>>
>>>> . tabdisp rep78, c(gini)
>>>>
>>>> ----------------------
>>>> Repair    |
>>>> Record    |
>>>> 1978      |       gini
>>>> ----------+-----------
>>>>         1 |   .0714286
>>>>         2 |   .1021242
>>>>         3 |   .1152087
>>>>         4 |   .1259259
>>>>         5 |   .1697372
>>>>         . |
>>>> ----------------------
>>>>
>>>> Is -vil- a string variable?
>>>>
>>>> Nick
>>>>
>>>> On Fri, Nov 16, 2012 at 10:13 PM, Megan Sheahan <[email protected]> wrote:
>>>>
>>>>> I downloaded the package for ineqdeco and am attempting to make
>>>>> village-level (denoted by variable "vil" in my data) gini coefficients
>>>>> using a variable in my data set called "totasvalall_10." I am trying
>>>>> to do this by running the command ineqdeco by vil, then trying to have
>>>>> Stata recall those values and put them into a variable named "gini."
>>>>>
>>>>> Below is the syntax that was suggested to me, although Stata is unable
>>>>> to recall any of the gini coefficients after running the second line.
>>>>> When it runs the "replace" line of code, no values are inserted into
>>>>> the variable "gini." So, it appears that Stata is not remembering the
>>>>> information after running ineqdeco. Am I missing something? I am using
>>>>> Stata 11.
>>>>>
>>>>> generate gini=.
>>>>> ineqdeco totasvalall_10, by(vil)
>>>>> foreach z in 1111 1112 1113 1114 1211 1221 1222 1311 ///
>>>>> 3111 3112 3211 3212 3213 3214 3311 3312 3313 3314 ///
>>>>> 3411 3412 3413 3414 3415 3416 3511 3512 4111 4112 4113 4114 ///
>>>>> 4115 4116 4211 4212 4221 4222 4223 4224 4231 4232 ///
>>>>> 5111 5112 5113 5121 5122 5131 5211 5212 5213 ///
>>>>> 5214 5221 5222 5223 5224 5231 5232 5311 5312 5313 5314 6111 ///
>>>>> 6112 6121 6122 6131 6132 6221 6222 6223 6224 6231 6232 6233 ///
>>>>> 6234 7111 7112 7113 7114 7211 7212 7221 7222 7231 7232 7233 ///
>>>>> 7234 7311 7312 7411 7412 7413 7421 7511 7512 7521 7522 7523 ///
>>>>> 7524{
>>>>> replace gini=r(gini_`z') if vil==`z'
>>>>> }
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index