Announcement

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

  • How to use margins to estimate conditional group means after oprobit

    Hello everybody,

    unfortunately I couldn't figure out how to make the margins command estimate conditional group means after oprobit - something that seems straight forward, r.g. if you want to compare the results of an OLS model for an ordered scale variable with ordered probit estimates.
    I couldn't find the answer in the help or here on the list, so I decided to just post it, since my requesti kinda urgent. But please direct me to the thread if you have knowledge of it.

    Here's a quick example using auto.dta.
    Suppose headroom is an ordered scale and I want to estimate the effect of foreign on it. So, I want to compare the mean of headroom for foreign==1 vs foreign==0.
    Now, in OLS that's just the coefficient.

    Code:
    sysuse auto, clear
    
    reg headroom foreign
    
    oprobit headroom foreign
    Let y be headroom and x be foreign and a0 to a7 be the cut-points between the categories of headroom.
    In the ordered probit case I would have to estimate the difference between
    Click image for larger version

Name:	equation.PNG
Views:	1
Size:	6.8 KB
ID:	1504275

    at x=1 and x=0 and obtain the standard error to test for it to be 0 (I took the equation from Woolridge (2010), p. 506).

    How could I impement that with margins after the ordered probit regression?

    Thank you very much in advance!
    Boris

  • #2
    I gather this text written by Richard Williams will be helpful to you.
    Best regards,

    Marcos

    Comment


    • #3
      Hello Marcos,
      thanks for replying. Yeah, I also found this text but it does not seem to respond to my exact question (or I am too blind to see it...).
      Best,
      Boris

      Comment


      • #4
        Hello statlisters,
        maybe it's bad style to push a thread by updating it with contentless replys by yourself... But then, I think this a question that might be of interest for many people. So isn't there anyone who ever did that with margins - as this seems to be a task that many people might have carried out or would wish to carry out (e.g. if you were doing OLS regressions with well-being scales and you find yourself checking robustness with models for ordered data).

        Thanks again!
        Boris

        Comment


        • #5
          Use margins to compute the marginal predicted probabilities for
          each level of the outcome variable, and make sure to add the post
          option to get margins to post the results to e(). Then
          use contrast or lincom to compute the rest.

          contrast requires less typing if you are familiar with custom
          contrast syntax and option lincom.

          Here is a simple example using the auto data.

          Code:
          sysuse auto
          ologit head i.foreign
          
          margins foreign, post coeflegend
          contrast {_predict 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0}@foreign, lincom
          contrast {_predict 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0}#r.foreign, lincom
          The first call to contrast shows that contrast can form
          the expected value of y at each level of foreign. The expected
          value of y is specified using a custom contrast on the marginal
          predictions with option lincom.

          The second call contrasts the expected value of y between the levels of
          foreign.

          Here is the output from this example.

          Code:
          . sysuse auto
          (1978 Automobile Data)
          
          . ologit head i.foreign
          
          Iteration 0:   log likelihood = -140.12837
          Iteration 1:   log likelihood = -137.01712
          Iteration 2:   log likelihood = -137.00384
          Iteration 3:   log likelihood = -137.00384
          
          Ordered logistic regression                     Number of obs     =         74
                                                          LR chi2(1)        =       6.25
                                                          Prob > chi2       =     0.0124
          Log likelihood = -137.00384                     Pseudo R2         =     0.0223
          
          ------------------------------------------------------------------------------
              headroom |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
               foreign |
              Foreign  |  -1.095327   .4436819    -2.47   0.014    -1.964927   -.2257264
          -------------+----------------------------------------------------------------
                 /cut1 |  -3.330358   .5577208                      -4.42347   -2.237245
                 /cut2 |  -1.699492   .3524444                      -2.39027   -1.008714
                 /cut3 |  -.7878984   .3094308                     -1.394372   -.1814252
                 /cut4 |    .004887    .285615                      -.554908    .5646821
                 /cut5 |   1.084231   .3116335                      .4734404    1.695021
                 /cut6 |   2.386144   .4729276                      1.459223    3.313065
                 /cut7 |   4.066587   1.010793                      2.085469    6.047705
          ------------------------------------------------------------------------------
          
          .
          . margins foreign, post
          Adjusted predictions                            Number of obs     =         74
          Model VCE    : OIM
          
          1._predict   : Pr(headroom==1.5), predict(pr outcome(1.5))
          2._predict   : Pr(headroom==2), predict(pr outcome(2))
          3._predict   : Pr(headroom==2.5), predict(pr outcome(2.5))
          4._predict   : Pr(headroom==3), predict(pr outcome(3))
          5._predict   : Pr(headroom==3.5), predict(pr outcome(3.5))
          6._predict   : Pr(headroom==4), predict(pr outcome(4))
          7._predict   : Pr(headroom==4.5), predict(pr outcome(4.5))
          8._predict   : Pr(headroom==5), predict(pr outcome(5))
          
          ------------------------------------------------------------------------------
                       |            Delta-method
                       |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
              _predict#|
               foreign |
           1#Domestic  |   .0345443   .0186005     1.86   0.063    -.0019121    .0710007
            1#Foreign  |   .0966485   .0495711     1.95   0.051     -.000509     .193806
           2#Domestic  |   .1199873   .0387682     3.09   0.002      .044003    .1959716
            2#Foreign  |   .2567428   .0678845     3.78   0.000     .1236916    .3897941
           3#Domestic  |   .1580885   .0425525     3.72   0.000     .0746871    .2414898
            3#Foreign  |   .2228661   .0534663     4.17   0.000     .1180741    .3276581
           4#Domestic  |   .1886017   .0475019     3.97   0.000     .0954997    .2817036
            4#Foreign  |   .1740427   .0455623     3.82   0.000     .0847422    .2633433
           5#Domestic  |    .246072     .05698     4.32   0.000     .1343933    .3577508
            5#Foreign  |   .1480985   .0446385     3.32   0.001     .0606087    .2355884
           6#Domestic  |   .1684708   .0498535     3.38   0.001     .0707598    .2661818
            6#Foreign  |   .0717572   .0306682     2.34   0.019     .0116487    .1318658
           7#Domestic  |   .0673883   .0328457     2.05   0.040      .003012    .1317646
            7#Foreign  |    .024146   .0146907     1.64   0.100    -.0046472    .0529392
           8#Domestic  |   .0168471    .016742     1.01   0.314    -.0159667    .0496608
            8#Foreign  |   .0056981   .0060654     0.94   0.348    -.0061899     .017586
          ------------------------------------------------------------------------------
          
          . contrast {_predict 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0}@foreign, lincom
          
          Contrasts of adjusted predictions               Number of obs     =         74
          Model VCE    : OIM
          
          1._predict   : Pr(headroom==1.5), predict(pr outcome(1.5))
          2._predict   : Pr(headroom==2), predict(pr outcome(2))
          3._predict   : Pr(headroom==2.5), predict(pr outcome(2.5))
          4._predict   : Pr(headroom==3), predict(pr outcome(3))
          5._predict   : Pr(headroom==3.5), predict(pr outcome(3.5))
          6._predict   : Pr(headroom==4), predict(pr outcome(4))
          7._predict   : Pr(headroom==4.5), predict(pr outcome(4.5))
          8._predict   : Pr(headroom==5), predict(pr outcome(5))
          
          ----------------------------------------------------
                           |         df        chi2     P>chi2
          -----------------+----------------------------------
          _predict@foreign |
             (1) Domestic  |          1      724.47     0.0000
              (1) Foreign  |          1      326.73     0.0000
                    Joint  |          2     1060.21     0.0000
          ----------------------------------------------------
          
          ------------------------------------------------------------------
                           |            Delta-method
                           |   Contrast   Std. Err.     [95% Conf. Interval]
          -----------------+------------------------------------------------
          _predict@foreign |
             (1) Domestic  |   3.175435   .1179754      2.944208    3.406663
              (1) Foreign  |   2.680273   .1482817      2.389646      2.9709
          ------------------------------------------------------------------
          
          . contrast {_predict 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0}#r.foreign, lincom
          
          Contrasts of adjusted predictions               Number of obs     =         74
          Model VCE    : OIM
          
          1._predict   : Pr(headroom==1.5), predict(pr outcome(1.5))
          2._predict   : Pr(headroom==2), predict(pr outcome(2))
          3._predict   : Pr(headroom==2.5), predict(pr outcome(2.5))
          4._predict   : Pr(headroom==3), predict(pr outcome(3))
          5._predict   : Pr(headroom==3.5), predict(pr outcome(3.5))
          6._predict   : Pr(headroom==4), predict(pr outcome(4))
          7._predict   : Pr(headroom==4.5), predict(pr outcome(4.5))
          8._predict   : Pr(headroom==5), predict(pr outcome(5))
          
          ----------------------------------------------------
                           |         df        chi2     P>chi2
          -----------------+----------------------------------
          _predict#foreign |          1        6.77     0.0093
          ----------------------------------------------------
          
          ----------------------------------------------------------------------------
                                     |            Delta-method
                                     |   Contrast   Std. Err.     [95% Conf. Interval]
          ---------------------------+------------------------------------------------
                    _predict#foreign |
          (1) (Foreign vs Domestic)  |  -.4951625   .1903328     -.8682079   -.1221171
          ----------------------------------------------------------------------------

          Comment


          • #6
            Hello Jeff,

            thank you for your advice! I am not yet familiar with the contrast command but thanks to your hint and your example I now know where to look at and how to approach the problem.

            Thanks again and best regards,
            Boris

            Comment

            Working...
            X