Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create a variable of Gini Coefficients after running ineqdeco command?

    Hi,

    I am calculating GINI Coefficients for different states based on two time periods. I have created a new which groups these two together. Based on that I have calculated Gini Coefficients running the ineqdeco command. However, I want to create a column based on the obtained Gini Coefficients. I have tried to follow the instructions mentioned in some posts but could not replicate them.

    My codes (don't know if I have done it correctly or not) and the Gini Coefficient table are:

    Code:
    grouplabs SURVEY STATEID, groupvar(group) val
    cap gen gini = .                               
    levels group, local(levels) 
    foreach i of local levels { 
        ineqdeco log_head_wage [weight=FWT] if group == `i'
          replace gini = $S_gini if group == `i' 
    } 
    
    
    
    Subgroup indices: GE_k(a) and Gini_k
    
    ------------------------------------------------------------------------------------------
            group(SURVEY STATEID) |     GE(-1)       GE(0)       GE(1)       GE(2)        Gini
    ------------------------------+-----------------------------------------------------------
       IHDS1 1 Jammu & Kashmir 01 |    0.03545     0.02749     0.02391     0.02236     0.11584
      IHDS1 1 Himachal Pradesh 02 |    0.01756     0.01792     0.01862     0.01969     0.10449
                IHDS1 1 Punjab 03 |    0.01742     0.01740     0.01780     0.01858     0.10276
            IHDS1 1 Chandigarh 04 |    0.02410     0.02337     0.02304     0.02307     0.12156
           IHDS1 1 Uttarakhand 05 |    0.01177     0.01176     0.01196     0.01237     0.08368
               IHDS1 1 Haryana 06 |    0.01195     0.01209     0.01242     0.01293     0.08527
                 IHDS1 1 Delhi 07 |    0.01349     0.01301     0.01273     0.01263     0.08954
             IHDS1 1 Rajasthan 08 |    0.02209     0.02182     0.02210     0.02293     0.11615
         IHDS1 1 Uttar Pradesh 09 |    0.04307     0.02429     0.02289     0.02375     0.11401
                 IHDS1 1 Bihar 10 |    0.02384     0.02221     0.02188     0.02258     0.10506
                IHDS1 1 Sikkim 11 |    0.00790     0.00776     0.00767     0.00763     0.07031
     IHDS1 1 Arunachal Pradesh 12 |    0.04480     0.03151     0.02437     0.02029     0.10047
              IHDS1 1 Nagaland 13 |    0.02101     0.02002     0.01944     0.01921     0.10853
               IHDS1 1 Manipur 14 |    0.01998     0.02020     0.02069     0.02147     0.11366
               IHDS1 1 Mizoram 15 |    0.00265     0.00265     0.00266     0.00268     0.04145
               IHDS1 1 Tripura 16 |    0.01843     0.01866     0.01935     0.02061     0.10451
             IHDS1 1 Meghalaya 17 |    0.03203     0.03161     0.03195     0.03310     0.14194
                 IHDS1 1 Assam 18 |    0.03366     0.03085     0.03008     0.03042     0.13741
           IHDS1 1 West Bengal 19 |    0.02979     0.02966     0.03103     0.03354     0.13242
             IHDS1 1 Jharkhand 20 |    0.02703     0.02823     0.03023     0.03320     0.13020
                IHDS1 1 Orissa 21 |    0.04431     0.02976     0.02830     0.02931     0.12572
          IHDS1 1 Chhattisgarh 22 |    0.04232     0.04348     0.04647     0.05163     0.16443
        IHDS1 1 Madhya Pradesh 23 |    0.03796     0.03060     0.03070     0.03295     0.12938
               IHDS1 1 Gujarat 24 |    0.03446     0.03399     0.03444     0.03583     0.14805
           IHDS1 1 Daman & Diu 25 |    0.02021     0.01905     0.01824     0.01772     0.10656
    IHDS1 1 Dadra+Nagar Haveli 26 |    0.01937     0.01956     0.02005     0.02089     0.11244
           IHDS1 1 Maharashtra 27 |    0.03295     0.03168     0.03163     0.03240     0.14199
        IHDS1 1 Andhra Pradesh 28 |    0.02370     0.02286     0.02285     0.02356     0.11637
             IHDS1 1 Karnataka 29 |    0.04350     0.03544     0.03418     0.03519     0.14392
                   IHDS1 1 Goa 30 |    0.01622     0.01473     0.01367     0.01293     0.08793
                IHDS1 1 Kerala 32 |    0.01088     0.01031     0.01000     0.00988     0.07511
            IHDS1 1 Tamil Nadu 33 |    0.01913     0.01903     0.01933     0.02004     0.10877
           IHDS1 1 Pondicherry 34 |    0.01547     0.01541     0.01557     0.01596     0.09802
       IHDS2 2 Jammu & Kashmir 01 |    0.06660     0.03713     0.02726     0.02327     0.11367
      IHDS2 2 Himachal Pradesh 02 |    0.01888     0.01835     0.01833     0.01876     0.10511
                IHDS2 2 Punjab 03 |    0.02057     0.01795     0.01706     0.01709     0.09390
            IHDS2 2 Chandigarh 04 |    0.02337     0.02419     0.02535     0.02692     0.12014
           IHDS2 2 Uttarakhand 05 |    0.03201     0.01990     0.01594     0.01466     0.08292
               IHDS2 2 Haryana 06 |    0.01769     0.01670     0.01634     0.01648     0.09467
                 IHDS2 2 Delhi 07 |    0.03335     0.02498     0.02226     0.02143     0.11558
             IHDS2 2 Rajasthan 08 |    0.02335     0.02247     0.02233     0.02282     0.11532
         IHDS2 2 Uttar Pradesh 09 |    0.03502     0.02829     0.02638     0.02645     0.12127
                 IHDS2 2 Bihar 10 |    0.01525     0.01412     0.01372     0.01384     0.08614
                IHDS2 2 Sikkim 11 |    0.02823     0.02675     0.02573     0.02509     0.12542
     IHDS2 2 Arunachal Pradesh 12 |    0.03346     0.02971     0.02703     0.02514     0.12354
              IHDS2 2 Nagaland 13 |    0.02946     0.03168     0.03462     0.03849     0.12507
               IHDS2 2 Manipur 14 |    0.03443     0.03211     0.03068     0.03000     0.13942
               IHDS2 2 Mizoram 15 |    0.02843     0.02673     0.02559     0.02493     0.12750
               IHDS2 2 Tripura 16 |    0.03086     0.02361     0.02020     0.01867     0.09964
             IHDS2 2 Meghalaya 17 |    0.01790     0.01776     0.01785     0.01817     0.10673
                 IHDS2 2 Assam 18 |    0.02356     0.02287     0.02307     0.02393     0.11723
           IHDS2 2 West Bengal 19 |    0.02437     0.02391     0.02462     0.02630     0.11595
             IHDS2 2 Jharkhand 20 |    0.02265     0.02264     0.02324     0.02452     0.11312
                IHDS2 2 Orissa 21 |    0.01494     0.01542     0.01628     0.01759     0.09359
          IHDS2 2 Chhattisgarh 22 |    0.05553     0.04169     0.03949     0.04150     0.14384
        IHDS2 2 Madhya Pradesh 23 |    0.03001     0.02287     0.02126     0.02151     0.10503
               IHDS2 2 Gujarat 24 |    0.03368     0.03176     0.03124     0.03181     0.13914
           IHDS2 2 Daman & Diu 25 |    0.00893     0.00916     0.00947     0.00987     0.07506
    IHDS2 2 Dadra+Nagar Haveli 26 |    0.01598     0.01612     0.01647     0.01703     0.10116
           IHDS2 2 Maharashtra 27 |    0.04005     0.02962     0.02661     0.02566     0.12754
        IHDS2 2 Andhra Pradesh 28 |    0.01137     0.01089     0.01074     0.01085     0.07754
             IHDS2 2 Karnataka 29 |    0.06730     0.02769     0.02294     0.02207     0.11184
                   IHDS2 2 Goa 30 |    0.00838     0.00812     0.00794     0.00781     0.07061
                IHDS2 2 Kerala 32 |    0.02483     0.01510     0.01230     0.01114     0.07609
            IHDS2 2 Tamil Nadu 33 |    0.01840     0.01574     0.01440     0.01374     0.08911
           IHDS2 2 Pondicherry 34 |    0.01355     0.01293     0.01250     0.01221     0.08775
    ------------------------------------------------------------------------------------------
    Last edited by Jose Williams; 18 Apr 2022, 04:35.

  • #2
    That appears correct, although rather than use $S_gini which is no longer documented in the output of help ineqdeco for latest version. I would use r(gini):
    Code:
          replace gini = r(gini) if group == `i'
    Code:
    . sysuse auto, clear
    (1978 automobile data)
    
    . ineqdeco price
     
      ...
      
    Generalized Entropy indices GE(a), where a = income difference
     sensitivity parameter, and Gini coefficient
    
    ----------------------------------------------------------------------
      All obs |     GE(-1)       GE(0)       GE(1)       GE(2)        Gini
    ----------+-----------------------------------------------------------
              |    0.08199     0.08605     0.09557     0.11289     0.23222
    ----------------------------------------------------------------------
       
      ...
    
    . generate gini_s = $S_gini
    
    . generate gini_r = r(gini)
    
    . list gini_* in 1
    
         +---------------------+
         |   gini_s     gini_r |
         |---------------------|
      1. | .2322248   .2322248 |
         +---------------------+
    
    .

    Comment

    Working...
    X