Announcement

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

  • Arranging predicted probabilities into a table (presentation question)

    Hi all,

    I have some predicted probabilities from the prtab command. These are shown below.

    Code:
     .  prtab quit skill,novarlbl
    
    ologit: Predicted probabilities for jbsat2
    
    Predicted probability of outcome 1 (not_satis_at_all)
    
    ----------------------------
              |      skill      
         quit |       0  skilled
    ----------+-----------------
            0 |  0.0113   0.0102
            1 |  0.0058   0.0053
    ----------------------------
    
    Predicted probability of outcome 2
    
    ----------------------------
              |      skill      
         quit |       0  skilled
    ----------+-----------------
            0 |  0.0260   0.0235
            1 |  0.0137   0.0123
    ----------------------------
    
    Predicted probability of outcome 3
    
    ----------------------------
              |      skill      
         quit |       0  skilled
    ----------+-----------------
            0 |  0.1251   0.1147
            1 |  0.0710   0.0645
    ----------------------------
    
    Predicted probability of outcome 4 (not_satis/dissat)
    
    ----------------------------
              |      skill      
         quit |       0  skilled
    ----------+-----------------
            0 |  0.0929   0.0872
            1 |  0.0592   0.0545
    ----------------------------
    
    Predicted probability of outcome 5
    
    ----------------------------
              |      skill      
         quit |       0  skilled
    ----------+-----------------
            0 |  0.3570   0.3511
            1 |  0.2981   0.2849
    ----------------------------
    
    Predicted probability of outcome 6
    
    ----------------------------
              |      skill      
         quit |       0  skilled
    ----------+-----------------
            0 |  0.3456   0.3667
            1 |  0.4734   0.4915
    ----------------------------
    
    Predicted probability of outcome 7 (completely_satis)
    
    ----------------------------
              |      skill      
         quit |       0  skilled
    ----------+-----------------
            0 |  0.0421   0.0466
            1 |  0.0789   0.0870
    ----------------------------
    I'm trying to present them in a table similar to the ones made using "outreg". I can't find any code for this, but I suspect there's a way to do it. Long and Freese show similar tables in their chapter on ordinal logistic regression, but don't list any code.


    Thanks in advance.

  • #2
    prtab is from Long & Freese's old spost9 routines. Unless you have an ancient version of Stata, I suggest you do

    findit spost13_ado

    and use the mtable command. Is this more like what you have in mind?

    Code:
    . webuse nhanes2f, clear
    
    . ologit health i.female i.race, nolog
    
    Ordered logistic regression                     Number of obs     =     10,335
                                                    LR chi2(3)        =     182.45
                                                    Prob > chi2       =     0.0000
    Log likelihood = -15673.171                     Pseudo R2         =     0.0058
    
    ------------------------------------------------------------------------------
          health |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
        1.female |   -.131102   .0352117    -3.72   0.000    -.2001156   -.0620884
                 |
            race |
          Black  |  -.7446752    .057536   -12.94   0.000    -.8574437   -.6319067
          Other  |  -.0856606   .1237325    -0.69   0.489    -.3281717    .1568506
    -------------+----------------------------------------------------------------
           /cut1 |  -2.754836   .0441146                     -2.841299   -2.668373
           /cut2 |  -1.361154   .0313824                     -1.422663   -1.299646
           /cut3 |  -.0816749   .0280282                     -.1366092   -.0267406
           /cut4 |   1.057518   .0301285                      .9984673    1.116569
    ------------------------------------------------------------------------------
    
    . mtable, at(female = (0 1) race = (1 2 3))
    
    Expression: Pr(health), predict(outcome())
    
               |   female      race      poor      fair   average      good  excellent
     ----------+----------------------------------------------------------------------
             1 |        0         1     0.060     0.144     0.276     0.263      0.258
             2 |        0         2     0.118     0.232     0.309     0.198      0.142
             3 |        0         3     0.065     0.154     0.283     0.257      0.242
             4 |        1         1     0.068     0.159     0.286     0.254      0.234
             5 |        1         2     0.132     0.248     0.308     0.185      0.126
             6 |        1         3     0.073     0.168     0.292     0.248      0.219
    
    Specified values where .n indicates no values specified with at()
    
               |  No at()
     ----------+---------
       Current |       .n
    
    .
    mtable has various options for prettying up the output.

    Even if this isn't what you want I would get spost13 regardless as it is much better than spost9. But before installing see

    http://www.indiana.edu/~jslsoc/spost13.htm
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Thanks Richard,

      I'm using an older copy of the book, so thanks for this. I have spost13 also, I just haven't made the switch to mtable. Any tips on getting it to run faster? Both mtable and mchange seem to stall once I run them.

      Comment


      • #4
        They generally work fine for me. If you can't get them to run then I would suggest posting your code and output in a new thread. Or write Scott Long and see what he can tell you. Follow Long's directions from my earlier link to make sure spost9 and spost13 co-exist peacefully. Also you may just need to be patient, especially if you have a big data set or a complicated model.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          See appendix A of

          http://www3.nd.edu/~rwilliam/xsoc73994/Ologit01.pdf

          for examples of how to use margins and mtable after running ologit.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            This looks helpful, thanks again.

            Comment


            • #7
              Hello everyone,

              I am having a similar problem with prtab commang after ologit. The error message says: cut1 not found. I updated the Spost13 version, forcing to replace the prior package, and I have Stata 15. But, still having the same problem. Just to be sure, I tried to uninstall spost13_ado but it returned an error message:

              . ado uninstall spost13_ado
              criterion matches more than one package

              Any thoughts about what I could be doing wrong?

              Best

              Comment


              • #8
                Hi Antonia. prtab is not included in spost13. mtable has superseded it. For suggestions on how to use margins and mtable with commands like ologit, see

                https://www3.nd.edu/~rwilliam/xsoc73994/Margins05.pdf

                You may also want to see

                https://www3.nd.edu/~rwilliam/xsoc73994/Margins04.pdf

                which includes information on the old spost9 commands if you still want to use them (although I can't imagine why you would).
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Thank you Richard

                  Comment

                  Working...
                  X