Announcement

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

  • How to capture information generated by the command "hoi"

    Hi Statalisters,

    I am using the "hoi" command to calculate the Human Opportunity Index for 27 states and 2 years and to get the decomposition of the Index for each state comparing the two years. The code I'm using is as follows:

    local predictors presmae metrop area logrenpcdef nmorad refsexo refraca medescresp difescresp

    local outcomes agua

    levelsof uf, local(ufs)
    foreach c of local ufs {
    display "uf = `c'"
    foreach o of varlist `outcomes' {
    capture noisily hoi `o' `predictors' [fw = pesopes] ///
    if uf == `c', by (ano) format(%9.3f) estimates decomp2
    if c(rc) == 2000 { // hoi FAILED DUE TO NO OBSERVATIONS
    display "Nao ha observacoes ou o outcome nao e dicotomico `o': analise ignorada"
    }
    else if c(rc) != 0 { // SOME OTHER ERROR AROSE ATTEMPTING hoi
    display in red "Erro encontrado ao executar o ioh com o outcome `o', uf = `c', ano = `y'"
    exit c(rc) // SHOW ERROR CODE AND STOP
    }

    }
    }


    The output of Stata to a state is as follows:

    Code:
    uf = 53
    
    (sum of wgt is   3,7435e+05)
    note: metrop dropped because of collinearity
    Iteration 0:   log pseudolikelihood = -555,11988
    Iteration 1:   log pseudolikelihood = -549,95284
    Iteration 2:   log pseudolikelihood = -549,63683
    Iteration 3:   log pseudolikelihood = -549,63609
    
    Logistic regression                               Number of obs   =       1724
                                                      Wald chi2(8)    =      15,00
                                                      Prob > chi2     =     0,0590
    Log pseudolikelihood = -549,63609                 Pseudo R2       =     0,0099
    
    ------------------------------------------------------------------------------
                 |               Robust
            agua |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         presmae |  -,2627851    ,473094    -0,56   0,579    -1,190032    ,6644622
            area |   ,7122128    ,242673     2,93   0,003     ,2365825    1,187843
     logrenpcdef |  -,0157898   ,0214751    -0,74   0,462    -,0578802    ,0263006
          nmorad |   ,0402422   ,0552911     0,73   0,467    -,0681263    ,1486107
         refsexo |   ,3394054   1,127855     0,30   0,763    -1,871149     2,54996
         refraca |   ,1862689   ,1616822     1,15   0,249    -,1306224    ,5031603
      medescresp |   -,018722   ,0228352    -0,82   0,412    -,0634781    ,0260342
      difescresp |   ,0011085   ,0337969     0,03   0,974    -,0651322    ,0673493
           _cons |   1,425572   1,415576     1,01   0,314    -1,348907    4,200051
    ------------------------------------------------------------------------------
    
    (sum of wgt is   3,7435e+05)
    note: metrop dropped because of collinearity
    Iteration 0:   log pseudolikelihood = -555,11988
    Iteration 1:   log pseudolikelihood = -549,95284
    Iteration 2:   log pseudolikelihood = -549,63683
    Iteration 3:   log pseudolikelihood = -549,63609
    
    Logistic regression                               Number of obs   =       1724
                                                      Wald chi2(8)    =      15,00
                                                      Prob > chi2     =     0,0590
    Log pseudolikelihood = -549,63609                 Pseudo R2       =     0,0099
    
    ------------------------------------------------------------------------------
                 |               Robust
            agua |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         presmae |  -,2627851    ,473094    -0,56   0,579    -1,190032    ,6644622
            area |   ,7122128    ,242673     2,93   0,003     ,2365825    1,187843
     logrenpcdef |  -,0157898   ,0214751    -0,74   0,462    -,0578802    ,0263006
          nmorad |   ,0402422   ,0552911     0,73   0,467    -,0681263    ,1486107
         refsexo |   ,3394054   1,127855     0,30   0,763    -1,871149     2,54996
         refraca |   ,1862689   ,1616822     1,15   0,249    -,1306224    ,5031603
      medescresp |   -,018722   ,0228352    -0,82   0,412    -,0634781    ,0260342
      difescresp |   ,0011085   ,0337969     0,03   0,974    -,0651322    ,0673493
           _cons |   1,425572   1,415576     1,01   0,314    -1,348907    4,200051
    ------------------------------------------------------------------------------
    WARNING :  ano = 95 : 1 initially selected circunstances were not used to estimate Pi.
    
    note: refsexo != 1 predicts success perfectly
          refsexo dropped and 101 obs not used
    
    (sum of wgt is   3,7210e+05)
    note: metrop dropped because of collinearity
    Iteration 0:   log pseudolikelihood = -127,39502
    Iteration 1:   log pseudolikelihood = -106,99904
    Iteration 2:   log pseudolikelihood = -100,02991
    Iteration 3:   log pseudolikelihood = -97,741978
    Iteration 4:   log pseudolikelihood = -97,334723
    Iteration 5:   log pseudolikelihood = -97,325352
    Iteration 6:   log pseudolikelihood = -97,325344
    
    Logistic regression                               Number of obs   =       1798
                                                      Wald chi2(7)    =      28,18
                                                      Prob > chi2     =     0,0002
    Log pseudolikelihood = -97,325344                 Pseudo R2       =     0,2360
    
    ------------------------------------------------------------------------------
                 |               Robust
            agua |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         presmae |   ,4367261   ,9265243     0,47   0,637    -1,379228     2,25268
            area |   ,2214284   ,6466493     0,34   0,732    -1,045981    1,488838
     logrenpcdef |   ,3554017   ,2264125     1,57   0,116    -,0883587    ,7991622
          nmorad |  -,3045169   ,1124967    -2,71   0,007    -,5250063   -,0840275
         refraca |  -,9231166    ,485408    -1,90   0,057    -1,874499    ,0282656
      medescresp |   ,3880012   ,1011046     3,84   0,000     ,1898399    ,5861625
      difescresp |  -,1500026   ,0815967    -1,84   0,066    -,3099292    ,0099239
           _cons |   2,616778   1,246677     2,10   0,036     ,1733361    5,060221
    ------------------------------------------------------------------------------
    
    (sum of wgt is   3,7435e+05)
    note: metrop dropped because of collinearity
    Iteration 0:   log pseudolikelihood = -555,11988
    Iteration 1:   log pseudolikelihood = -549,95284
    Iteration 2:   log pseudolikelihood = -549,63683
    Iteration 3:   log pseudolikelihood = -549,63609
    
    Logistic regression                               Number of obs   =       1724
                                                      Wald chi2(8)    =      15,00
                                                      Prob > chi2     =     0,0590
    Log pseudolikelihood = -549,63609                 Pseudo R2       =     0,0099
    
    ------------------------------------------------------------------------------
                 |               Robust
            agua |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         presmae |  -,2627851    ,473094    -0,56   0,579    -1,190032    ,6644622
            area |   ,7122128    ,242673     2,93   0,003     ,2365825    1,187843
     logrenpcdef |  -,0157898   ,0214751    -0,74   0,462    -,0578802    ,0263006
          nmorad |   ,0402422   ,0552911     0,73   0,467    -,0681263    ,1486107
         refsexo |   ,3394054   1,127855     0,30   0,763    -1,871149     2,54996
         refraca |   ,1862689   ,1616822     1,15   0,249    -,1306224    ,5031603
      medescresp |   -,018722   ,0228352    -0,82   0,412    -,0634781    ,0260342
      difescresp |   ,0011085   ,0337969     0,03   0,974    -,0651322    ,0673493
           _cons |   1,425572   1,415576     1,01   0,314    -1,348907    4,200051
    ------------------------------------------------------------------------------
    WARNING :  ano = 2002 : 2 initially selected circunstances were not used to estimate Pi.
    
    --------------------------------------------------------------------------
                                  |                    Type                   
             By: ano and Variable |    Values  Std Error    LB (95)    UB (95)
    ------------------------------+-------------------------------------------
    95                            |
                     Coverage (C) |    90,140      0,716     88,737     91,543
                Dissemilarity (D) |     0,907      1,242     -1,527      3,341
    Human Opportunity Index (HOI) |    89,322      0,809     87,736     90,908
                        Pseudo R2 |     0,010                                 
                        Obs Logit |  1724,000                                 
                              Obs |  1724,000                                 
                          Wtg Pop |  3,74e+05                                 
                   Vulnerable Pop |  1,29e+05                                 
                   Vulnerable (%) |    34,514                                 
                            Obs 1 |  1724,000                                 
                            Obs 2 |  1724,000                                 
                         Loss (%) |     0,000                                 
    ------------------------------+-------------------------------------------
    2002                          |
                     Coverage (C) |    98,666      0,253     98,170     99,161
                Dissemilarity (D) |     0,811      0,916     -0,985      2,608
    Human Opportunity Index (HOI) |    97,865      0,405     97,071     98,659
                        Pseudo R2 |     0,236                                 
                        Obs Logit |  1798,000                                 
                              Obs |  1798,000                                 
                          Wtg Pop |  3,72e+05                                 
                   Vulnerable Pop | 93747,000                                 
                   Vulnerable (%) |    25,194                                 
                            Obs 1 |  1899,000                                 
                            Obs 2 |  1899,000                                 
                         Loss (%) |     0,000                                 
    --------------------------------------------------------------------------
    
    ------------------------------------------------
    Decomposition 2: Composition, |
    Equalizatio and Scale effects |     By: ano     
    and Variable                  |      95     2002
    ------------------------------+-----------------
    Original                      |
                     Coverage (C) |  90,140   98,666
                Dissemilarity (D) |   0,907    0,811
    Human Opportunity Index (HOI) |  89,322   97,865
    ------------------------------+-----------------
    Decomposition (p.p.)          |
                    Change (p.p.) |            8,543
               Composition (p.p.) |           -0,371
                     Scale (p.p.) |            8,840
              Equalization (p.p.) |            0,074
    ------------------------------+-----------------
    Decomposition (%)             |
                  Composition (%) |           -4,341
                        Scale (%) |          103,478
                 Equalization (%) |            0,863
    ------------------------------------------------

    I would like to know how to modify my code in order to capture the following informations:

    1 - Coverage (C)
    2 - Dissemilarity (D)
    3 - Human Opportunity Index (HOI)
    4 - Change (p.p.)
    5 - Composition (p.p.)
    6 - Scale (p.p.)
    7 - Equalization (p.p.)
    5 - Composition (%)
    6 - Scale (%)
    7 - Equalization (%)


    Thanks in advance.

  • #2
    Quoting from FAQ Advice #12

    If you are using user-written commands, explain that and say where they came from: the Stata Journal, SSC, or other archives. This helps (often crucially) in explaining your precise problem, and it alerts readers to commands that may be interesting or useful to them.

    Here are some examples:
    I am using xtreg in Stata 13.1.
    I am using estout from SSC in Stata 13.1.
    I did a search hoi and got 80 hits, many on choice, etc. At that point I gave up.

    It really is your job to tell us where this program comes from.

    Comment


    • #3
      Nick,

      I'm using hoi from SSC in Stata 12

      Comment


      • #4
        That's helpful. All I can see in the help is

        Saved Results

        hoi return results in r() format. Type return list after estimation.
        That's not very helpful. The clear standard here is a list of named results with statements of what they are.

        At this point, I bail out as I don't have the inclination to read the help, read the code, or play with the command, which is far from trivial. So I can't even guess whether (a) what you want is easy because your shopping list is matched by saved results, or (b) your shopping list implies a substantial programming job.

        Others may be able to help (much) more.


        Comment


        • #5
          I would try asking for support via the e-mail address shown in the output from:
          Code:
          ssc describe hoishapely
          HTH.
          --
          Bruce Weaver
          Email: [email protected]
          Version: Stata/MP 18.5 (Windows)

          Comment


          • #6
            Originally posted by Shahla Akram
            I am using hoishapley decomposition but it shows this massage
            help hoishapley

            . hoishapley hhop [fw=weights] if year==2006, shapley( psch light santi water)
            weights not found
            r(111);
            when i remove weight

            . hoishapley hhop if year==2006, shapley( psch light santi water)
            unrecognized command: catenate
            r(199);
            - One needs to install package catenate
            Code:
            ssc install catenate

            Comment


            • #7
              anyone can help me to run inter generational mobility and intra generational mobility in different way as relative, absolute, decomposition, upper and lower mobility in stata 13.
              thank you

              Comment

              Working...
              X