Announcement

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

  • Time inequality analysis - Generating Gini Index & 90/10 pctile

    Hi everyone,
    I am using Italian Time use data, I will post a fake example of it:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str6 individual double(play_mother sport_mother)
    "1"   30 20
    "2"   0  0
    "3"  40  30
    "4"   0  10
    "5"   70  0
    "6"   0  0
    "7"   100  0
    "8"   0  0
    "9"   0  20
    "10"  150  90
    end
    where "individua"l is the identifier of individual "j", "play_mother" and "sport_mother" are variables indicating the amount of time spent with mother in playing and doing sport.
    I would like to analyze the distribution of time spent in playing and doing sports by the child with the mother, in particular I would like to compute the Gini Index and the ratio between the 90th and 10th percentiles! Is there a way to compute them in Stata and, eventually, to export them (for example using something like "estout" "outreg")?
    Thank you in advance
    Andrea

  • #2
    Code:
    clear
    input str6 individual double(play_mother sport_mother)
    "1"   30 20
    "2"   0  0
    "3"  40  30
    "4"   0  10
    "5"   70  0
    "6"   0  0
    "7"   100  0
    "8"   0  0
    "9"   0  20
    "10"  150  90
    end
    
    ineqdec0 play_mother // ssc describe ineqdec0; ssc describe ineqdeco
    ineqdec0 sport_mother
    return list
    results in

    Code:
    . clear
    
    . input str6 individual double(play_mother sport_mother)
    
         individ~l  play_mot~r  sport_mo~r
      1. "1"   30 20
      2. "2"   0  0
      3. "3"  40  30
      4. "4"   0  10
      5. "5"   70  0
      6. "6"   0  0
      7. "7"   100  0
      8. "8"   0  0
      9. "9"   0  20
     10. "10"  150  90
     11. end
    
    .
    . ineqdec0 play_mother // ssc describe ineqdec0; ssc describe ineqdeco
     
    Warning: play_mother has 5 values = 0. Used in calculations
    Note: p25 (and smaller percentiles) <= 0
     
    Percentile ratios
    
    ----------------------------------------------------------
      All obs |    p90/p10     p90/p50     p10/p50     p75/p25
    ----------+-----------------------------------------------
              |                  8.333       0.000           
    ----------------------------------------------------------
     
    Generalized Entropy index GE(2), and Gini coefficient
    
    ----------------------------------
      All obs |      GE(2)        Gini
    ----------+-----------------------
              |    0.81164     0.65385
    ----------------------------------
    
    . ineqdec0 sport_mother
     
    Warning: sport_mother has 5 values = 0. Used in calculations
    Note: p25 (and smaller percentiles) <= 0
     
    Percentile ratios
    
    ----------------------------------------------------------
      All obs |    p90/p10     p90/p50     p10/p50     p75/p25
    ----------+-----------------------------------------------
              |                 12.000       0.000           
    ----------------------------------------------------------
     
    Generalized Entropy index GE(2), and Gini coefficient
    
    ----------------------------------
      All obs |      GE(2)        Gini
    ----------+-----------------------
              |    1.21280     0.70000
    ----------------------------------
    
    .. return list
    
    scalars:
                  r(wgini) =  5.100000000000001
                    r(ge2) =  1.21280276816609
                   r(gini) =  .7
                 r(p75p50) =  4
                 r(p25p50) =  0
                 r(p10p50) =  0
                 r(p90p50) =  12
                 r(p75p25) =  .
                 r(p90p10) =  .
                    r(p95) =  90
                    r(p90) =  60
                    r(p75) =  20
                    r(p50) =  5
                    r(p25) =  0
                    r(p10) =  0
                     r(p5) =  0
                    r(max) =  90
                    r(min) =  0
                      r(N) =  10
                   r(sumw) =  10
                     r(sd) =  27.9085809185793
                    r(Var) =  778.8888888888889
                   r(mean) =  17
    You can manipulate the results stored in r(), e.g. using Ben Jann's esto

    Comment


    • #3
      Thank You very much Stephen!

      Comment


      • #4
        Dear Professor Jenkins, I tried with estout but it tells me that there is no estimation results stored...do I need to put other commands (like estpost) before proceeding with estout?

        Comment


        • #5
          When I wrote
          You can manipulate the results stored in r(), e.g. using Ben Jann's esto
          , I should have written
          You can manipulate the results stored in r(), e.g. using Ben Jann's estadd
          . Look at the help file for it, and see how it will place in e()

          Comment


          • #6
            Thank you very much for your help!

            Comment

            Working...
            X