Announcement

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

  • ineqdeceo - calculate gini for different subgroups with contribution to total

    Hi everyone; i m new on Stata. So I m new on Stata so i had to consult here. i have wealth variables of person who died. these people have som honorific titiles. i want to see intra-group and between group inequality but also want to see gini contributions to overall gini. so i used ineqdeco command, and then "return list" .

    . return list

    scalars:

    r(ede2) = 20330.27098899694
    r(ede1) = 44576.47437925962
    r(edehalf) = 66521.25365573603
    r(between_a2) = .1202628999210008
    r(between_a1) = .0617805982848419
    r(between_ahalf) = .0287198015642444
    r(within_a2) = .7599909809184966
    r(within_a1) = .5065551779746393
    r(within_ahalf) = .2886993717996624
    r(a2_3) = .7825259936571144
    r(a1_3) = .5225974917411804
    r(ahalf_3) = .2913051749565403
    r(a2_2) = .7740103721558161
    r(a1_2) = .5377354621887207
    r(ahalf_2) = .3282960461482253
    r(a2_1) = .683186016995525
    r(a1_1) = .4126750826835632
    r(ahalf_1) = .2095925837965658
    r(between_ge2) = .0464823953855145
    r(between_ge1) = .0416233751258453
    r(between_ge0) = .0384595274391314
    r(between_gem1) = .0365809050768381
    r(within_ge2) = 1.121531331904797
    r(within_ge1) = .6562591383432529
    r(within_ge0) = .7316561329462238
    r(within_gem1) = 1.831461826609987
    r(sumw_3) = 97
    r(v_3) = .4145299145299146
    r(lambda_3) = 1.066504602831005
    r(theta_3) = .442098061857297
    r(lgmean_3) = 11.53946375368956
    r(mean_3) = 102689.3564948454
    r(gini_3) = .5920576594975053
    r(ge2_3) = .9069654585267596
    r(ge1_3) = .6274381621047558
    r(ge0_3) = .7393952772397693
    r(gem1_3) = 1.799125345636311
    r(sumw_2) = 111
    r(v_2) = .4743589743589743
    r(lambda_2) = .7633332675532834
    r(theta_2) = .3620939858906601
    r(lgmean_2) = 11.20501662166448
    r(mean_2) = 73498.23135135135
    r(gini_2) = .6200976741671276
    r(ge2_2) = 1.956877415016125
    r(ge1_2) = .8253289149049929
    r(ge0_2) = .7716179184731826
    r(gem1_2) = 1.712490921683989
    r(sumw_1) = 26
    r(v_1) = .1111111111111111
    r(lambda_1) = 1.762271570268389
    r(theta_1) = .1958079522520432
    r(lgmean_1) = 12.04168082072447
    r(mean_1) = 169681.9057692308
    r(gini_1) = .4910979418316964
    r(ge2_1) = .4434495360779261
    r(ge1_1) = .4086826175970001
    r(ge0_1) = .5321770871783036
    r(gem1_1) = 1.078213168681186
    r(a2) = .7888551615604363
    r(a1) = .537040480861859
    r(ahalf) = .3091277846940984
    r(ge2) = 1.168013727290313
    r(ge1) = .697882513469098
    r(ge0) = .7701156603853567
    r(gem1) = 1.868042731686836
    r(gini) = .6116433251381541
    r(p75p50) = 2.884325969362665
    r(p25p50) = .4374031565176243
    r(p10p50) = .2008837692643143
    r(p90p50) = 4.98278853558737
    r(p75p25) = 6.594204743116542
    r(p90p10) = 24.80433612847651
    r(p95) = 336984
    r(p90) = 214812
    r(p75) = 124345.6
    r(p50) = 43110.8
    r(p25) = 18856.8
    r(p10) = 8660.26
    r(p5) = 4571
    r(max) = 1201480
    r(min) = 1723.2
    r(N) = 234
    r(sumw) = 234
    r(sd) = 147479.4936055905
    r(Var) = 21750201034.16142
    r(mean) = 96285.90089743589


    my overall Gini= 0.61164; so i could not calculate with these results to total gini. (with their contributions) If anyone help me i would be glad.






  • #2
    The Gini coefficient is not additively decomposable by population subgroup in general, unlike generalised entropy inequality indices. See ineqdecgini (by me, SSC), including discussion and references in the help-file. The presence of negative values may cause issues. I recommend using targeted searches using -search- and relevant keywords, or indeed Googling more generally, would be appropriate before posting again. Good luck

    Comment


    • #3
      Did not want to start a new topic. so writing here my querry. Expect replies from Professors.
      I am using ineqdeco to calculate wage inequality. I want to calculate wage inequality among two different classes of workers ; casual and regular salaried. When I run ineqdeco command, I dont get results.
      An example of dataset is below
      Code:
      * Example generated by -dataex-. To install:    ssc    install    dataex
      clear
      input float dailywage byte cws_worker
      5.714286 2
      6 2
      6.571429 2
      7.142857 2
      7.142857 2
      7.142857 2
      7.142857 2
      7.714286 2
      8.285714 2
      8.571428 2
      9.285714 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10 2
      10.428572 2
      10.714286 2
      10.714286 2
      10.714286 2
      10.714286 2
      10.714286 2
      10.714286 2
      10.714286 2
      10.714286 2
      11.428572 2
      11.428572 2
      11.428572 2
      11.428572 2
      11.428572 2
      12.142858 2
      12.142858 2
      12.142858 2
      12.714286 2
      12.857142 2
      12.857142 2
      12.857142 2
      12.857142 2
      12.857142 2
      13.285714 2
      13.285714 2
      13.285714 2
      13.285714 2
      13.285714 2
      13.285714 2
      13.285714 2
      13.285714 2
      13.428572 2
      13.571428 2
      13.714286 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      14.285714 2
      end
      label values cws_worker workers
      label def workers 2 "Regular worker", modify
      result turns to be
      Click image for larger version

Name:	gini.png
Views:	1
Size:	20.2 KB
ID:	1741286



      Kindly help.

      Comment


      • #4
        In your data example all observations show cws_worker equal to 2.

        Comment


        • #5
          This shows in the example dataset. I have nonetheless cws_worker=3 and 1 also. I guess the dataset is sorted. I am resharing another dataex example

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input byte cws_worker
          1
          3
          1
          1
          1
          1
          3
          1
          3
          1
          1
          1
          1
          1
          1
          1
          1
          1
          1
          1
          1
          1
          1
          2
          1
          3
          1
          3
          1
          1
          3
          1
          3
          1
          1
          3
          1
          1
          1
          1
          1
          1
          1
          1
          1
          1
          1
          3
          1
          1
          3
          1
          1
          1
          3
          1
          1
          1
          1
          1
          1
          1
          1
          1
          1
          3
          1
          1
          1
          1
          1
          3
          3
          1
          1
          3
          1
          1
          1
          3
          1
          1
          1
          1
          1
          2
          1
          1
          1
          3
          1
          1
          1
          1
          1
          1
          1
          3
          3
          3
          end
          label values cws_worker workers
          label def workers 1 "Self-employed", modify
          label def workers 2 "Regular worker", modify
          label def workers 3 "Casual worker", modify

          Comment


          • #6
            Nick Cox please help.

            Comment


            • #7
              We need a data example with both variables that shows the problem reported in #3.

              Comment


              • #8
                Sorry, Nick. Here is the data example. Hope this suffices

                Code:
                * Example generated by -dataex-. To install: ssc install dataex
                clear
                input float dailywage byte cws_worker
                 4.285714 2
                        5 3
                 6.857143 2
                 6.857143 2
                 7.142857 2
                 7.142857 2
                 8.333333 3
                 8.571428 2
                 8.571428 3
                       10 3
                       10 2
                       10 3
                       10 2
                       10 3
                       10 2
                       10 3
                       10 2
                       10 3
                       10 2
                10.142858 2
                10.714286 2
                10.714286 2
                10.714286 3
                10.714286 3
                11.428572 3
                11.428572 2
                11.428572 3
                12.571428 2
                12.857142 2
                12.857142 2
                12.857142 2
                12.857142 2
                12.857142 2
                       13 2
                       13 2
                       14 2
                14.285714 3
                14.285714 3
                14.285714 3
                14.285714 3
                14.285714 2
                14.285714 2
                14.285714 3
                14.285714 2
                14.285714 2
                14.285714 2
                14.285714 2
                14.285714 2
                14.285714 2
                14.285714 3
                14.285714 3
                14.285714 3
                14.285714 3
                14.285714 3
                14.285714 3
                14.285714 3
                14.285714 3
                14.285714 2
                14.285714 2
                14.285714 3
                14.285714 2
                14.285714 3
                14.285714 3
                14.285714 2
                14.285714 3
                14.285714 2
                14.285714 3
                14.285714 2
                       15 3
                       15 2
                       15 3
                       15 3
                       15 3
                15.714286 2
                15.714286 3
                15.714286 3
                15.714286 2
                       16 3
                       16 2
                       16 3
                       16 2
                16.142857 2
                16.571428 2
                16.571428 2
                16.571428 2
                16.714285 2
                16.714285 3
                16.714285 3
                16.714285 3
                16.714285 3
                16.714285 2
                16.714285 2
                16.714285 2
                16.714285 2
                16.714285 2
                16.714285 2
                16.714285 2
                       17 2
                17.142857 3
                17.142857 2
                17.142857 3
                17.142857 2
                17.142857 2
                17.142857 3
                17.142857 2
                17.142857 3
                17.142857 3
                17.142857 2
                17.142857 3
                17.142857 3
                17.142857 2
                17.142857 2
                17.142857 3
                17.142857 3
                17.142857 3
                17.142857 3
                17.142857 2
                17.142857 3
                17.285715 2
                17.857143 2
                17.857143 2
                17.857143 3
                17.857143 3
                17.857143 2
                17.857143 3
                17.857143 2
                17.857143 2
                17.857143 3
                17.857143 2
                17.857143 3
                17.857143 2
                17.857143 2
                17.857143 3
                17.857143 3
                17.857143 2
                       18 2
                       18 2
                       18 2
                       18 3
                       18 2
                18.333334 3
                18.333334 3
                18.571428 3
                18.571428 2
                18.571428 2
                18.571428 3
                18.571428 3
                18.571428 2
                18.571428 3
                       19 2
                19.285715 2
                19.333334 3
                19.714285 2
                       20 3
                       20 2
                       20 2
                       20 2
                       20 2
                       20 3
                       20 3
                       20 3
                       20 3
                       20 3
                       20 3
                       20 3
                       20 2
                       20 3
                       20 3
                       20 2
                       20 2
                       20 2
                       20 2
                       20 2
                       20 3
                       20 3
                       20 2
                       20 3
                       20 2
                       20 2
                       20 2
                       20 3
                       20 3
                       20 3
                       20 2
                       20 3
                       20 3
                       20 2
                       20 2
                       20 2
                       20 3
                       20 2
                       20 3
                20.285715 2
                20.333334 3
                 20.57143 2
                20.714285 2
                20.714285 3
                20.833334 3
                 21.42857 2
                 21.42857 2
                end
                label values cws_worker workers
                label def workers 2 "Regular worker", modify
                label def workers 3 "Casual worker", modify

                Comment


                • #9
                  Thanks for the data example. That works for me.

                  Code:
                  . ineqdeco dailywage, by(cws_worker)
                   
                  Percentile ratios
                  
                  ----------------------------------------------------------
                    All obs |    p90/p10     p90/p50     p10/p50     p75/p25
                  ----------+-----------------------------------------------
                            |      1.918       1.167       0.608       1.340
                  ----------------------------------------------------------
                    
                  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.03832     0.03100     0.02669     0.02405     0.11969
                  ----------------------------------------------------------------------
                     
                  Atkinson indices, A(e), where e > 0 is the inequality aversion parameter
                  
                  ----------------------------------------------
                    All obs |     A(0.5)        A(1)        A(2)
                  ----------+-----------------------------------
                            |    0.01424     0.03052     0.07118
                  ----------------------------------------------
                    
                  Subgroup summary statistics, for each subgroup k = 1,...,K:
                    
                  
                  ------------------------------------------------------------------------------------------
                      cws_worker |   Popn. share           Mean  Relative mean   Income share      log(mean)
                  ---------------+--------------------------------------------------------------------------
                  Regular worker |       0.54000       16.02778        0.99075        0.53500        2.77432
                   Casual worker |       0.46000       16.35326        1.01086        0.46500        2.79443
                  ------------------------------------------------------------------------------------------
                    
                  Subgroup indices: GE_k(a) and Gini_k 
                  
                  ---------------------------------------------------------------------------
                      cws_worker |     GE(-1)       GE(0)       GE(1)       GE(2)        Gini
                  ---------------+-----------------------------------------------------------
                  Regular worker |    0.04350     0.03475     0.02967     0.02660     0.12610
                   Casual worker |    0.03200     0.02648     0.02316     0.02107     0.11175
                  ---------------------------------------------------------------------------
                    
                  Within-group inequality, GE_W(a)
                  
                  ----------------------------------------------------------
                    All obs |     GE(-1)       GE(0)       GE(1)       GE(2)
                  ----------+-----------------------------------------------
                            |    0.03827     0.03095     0.02664     0.02400
                  ----------------------------------------------------------
                                
                  Between-group inequality, GE_B(a):
                  
                  ----------------------------------------------------------
                    All obs |     GE(-1)       GE(0)       GE(1)       GE(2)
                  ----------+-----------------------------------------------
                            |    0.00005     0.00005     0.00005     0.00005
                  ----------------------------------------------------------
                                
                  Subgroup Atkinson indices, A_k(e)
                  
                  ---------------------------------------------------
                      cws_worker |     A(0.5)        A(1)        A(2)
                  ---------------+-----------------------------------
                  Regular worker |    0.01588     0.03415     0.08003
                   Casual worker |    0.01227     0.02613     0.06014
                  ---------------------------------------------------
                    
                  Within-group inequality, A_W(e)
                  
                  ----------------------------------------------
                    All obs |     A(0.5)        A(1)        A(2)
                  ----------+-----------------------------------
                            |    0.01420     0.03042     0.07079
                  ----------------------------------------------
                   
                  Between-group inequality, A_B(e)
                  
                  ----------------------------------------------
                    All obs |     A(0.5)        A(1)        A(2)
                  ----------+-----------------------------------
                            |    0.00004     0.00010     0.00043
                  ----------------------------------------------
                  I am using ineqdeco 2.1.0 from SSC, as below.

                  Code:
                  . which ineqdeco
                  
                  *! 2.1.0 SPJ Feb 2021 Add pweight so that use PVK's -rhsbsample- & svy bootstrap 
                  *! 2.0.2 SPJ May 2008 (fix bug arising if bygroup() and `touse' lead to no obs in a group)
                  *!   bug fix method provided by Austin Nichols (many thanks!)
                  *! 2.0.1 SPJ August 2006 (new vbles created as doubles)
                  *! 2.0.0 SPJ August 2006 (port to Stata 8.2; additional saved results), 
                  *!   with initial code rewriting contribution from Nick Cox (many thanks!)
                  *! version 1.6 April 2001 (made compatible with Stata 7; SSC)
                  *! version 1.0.1 Stephen P. Jenkins, April 1998   STB-48 sg104
                  *! Inequality indices, with optional decomposition by population subgroups

                  Comment


                  • #10
                    The above data example is from a survey round of 2011-12. ineqdeco command produces the desired result. However, the command does not give the desired result when applied to a different survey round of 2009-10. The data example from 2009-10 round is produced below.

                    copy starting from the next line ------ ----------------
                    Code:
                    * Example generated by -dataex-. To install: ssc install    dataex
                    clear
                    input float dailywage byte cws_worker
                    60 3
                    80 3
                    70 3
                    100 3
                    50 3
                    85.71429 3
                    80 3
                    50 3
                    150 3
                    80 3
                    50 3
                    50 3
                    100 3
                    71.42857 3
                    110 3
                    60 3
                    64.28571 3
                    100 3
                    70 3
                    80 3
                    90 3
                    30 3
                    . 3
                    120 3
                    80 3
                    100 3
                    30 3
                    77.57143 2
                    140 3
                    142.85715 2
                    235.7143 2
                    747.5714 2
                    178.57143 2
                    110 3
                    150 3
                    267.85715 2
                    100 3
                    50 3
                    214.2857 2
                    66.71429 2
                    70 3
                    100 3
                    285.7143 2
                    71.42857 2
                    357.14285 2
                    200 2
                    100 3
                    100 3
                    111.66666 3
                    100 3
                    214.2857 2
                    150 3
                    40 2
                    464.2857 2
                    700 2
                    333 2
                    300 3
                    50 3
                    214.2857 2
                    368.85715 2
                    178.57143 2
                    321.4286 2
                    364.2857 2
                    110 3
                    117.85714 2
                    100 3
                    80 3
                    80 3
                    150 3
                    225 3
                    120 3
                    80 3
                    150 3
                    60 3
                    150 3
                    120 3
                    408.2857 2
                    130 3
                    214.2857 3
                    125.71429 3
                    150 3
                    106 3
                    100 3
                    217.14285 3
                    120 3
                    107.14286 3
                    106 3
                    100 3
                    160 3
                    100 3
                    85.71429 3
                    120 3
                    150 3
                    433.2857 2
                    80 3
                    200 3
                    300 3
                    100 3
                    75 3
                    100 3
                    end
                    label values cws_worker workers
                    label def workers 2 "Regular worker", modify
                    label def workers 3 "Casual worker", modify

                    Comment


                    • #11
                      Once again, it works for me in the sense that I see output. But "does not give the desired result" could mean something else.

                      Comment


                      • #12
                        it gives results for percentile ratios, and Atkinson indices but not the GE indices including the Gini coefficient. This problem persists even when I remove dailywage =0 from the dataset. This problem is faced only in 2009-10 round not other rounds.
                        Nonetheless, thanks a lot.

                        Comment

                        Working...
                        X