Announcement

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

  • Ordered probit regression analysis in STATA

    Dear STATA users,

    I have to run some oprobit models
    oprobit y x1 x1 x2 x3 ...
    in STATA and as a R-user I wonder if there are any ways of plotting the coefficients for each level? I have a trichotomous dependent variable (0,1,2) and it would be useful to she the coefficients for each level.

    I appreciate all suggestions!







  • #2
    I am not sure if this is particularly useful exercise, but there are a couple of ways of doing that:

    Code:
    webuse fullauto, clear
    xtile mpg_cat = mpg, nq(3)
    
    oprobit rep77 i.mpg_cat
    coefplot
    
    oprobit rep77 i.mpg_cat
    margins, dydx(*) predict(xb)
    marginsplot, recast(scatter)
    -coefplot- is a user-written program that you can install from SSC.

    Comment


    • #3
      Hi Dimitriy - and thanks for this.

      I was thinking something that would shoud coefficients for each level of the dependent variable. This command - as I see it - shows the "raw" coefficients. This is great for binary logistic models but makes little sense for ordered. I'm thinking that perhaps the margins command could fix this. For example by generating average marginal effects for all variables at each level of the DV...

      Comment


      • #4
        Code:
        . sysuse auto, clear
        (1978 Automobile Data)
        
        . recode rep78 1/2=3
        (rep78: 10 changes made)
        
        . oprobit rep78 mpg i.foreign, nolog
        
        Ordered probit regression                       Number of obs     =         69
                                                        LR chi2(2)        =      31.79
                                                        Prob > chi2       =     0.0000
        Log likelihood = -50.299137                     Pseudo R2         =     0.2401
        
        ------------------------------------------------------------------------------
               rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 mpg |   .0587834   .0299238     1.96   0.049     .0001337     .117433
                     |
             foreign |
            Foreign  |    1.44881   .3612085     4.01   0.000     .7408545    2.156766
        -------------+----------------------------------------------------------------
               /cut1 |    1.88242   .6278802                      .6517976    3.113043
               /cut2 |   3.074515   .6987686                      1.704953    4.444076
        ------------------------------------------------------------------------------
        
        . margins, dydx(*)
        
        Average marginal effects                        Number of obs     =         69
        Model VCE    : OIM
        
        dy/dx w.r.t. : mpg 1.foreign
        1._predict   : Pr(rep78==3), predict(pr outcome(3))
        2._predict   : Pr(rep78==4), predict(pr outcome(4))
        3._predict   : Pr(rep78==5), predict(pr outcome(5))
        
        ------------------------------------------------------------------------------
                     |            Delta-method
                     |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        mpg          |
            _predict |
                  1  |  -.0163376   .0080357    -2.03   0.042    -.0320873   -.0005879
                  2  |   .0068833   .0037369     1.84   0.065    -.0004409    .0142075
                  3  |   .0094543   .0046804     2.02   0.043     .0002809    .0186277
        -------------+----------------------------------------------------------------
        0.foreign    |  (base outcome)
        -------------+----------------------------------------------------------------
        1.foreign    |
            _predict |
                  1  |   -.506235   .1141719    -4.43   0.000    -.7300078   -.2824621
                  2  |   .1899206   .0686743     2.77   0.006     .0553214    .3245198
                  3  |   .3163143   .1013057     3.12   0.002     .1177588    .5148699
        ------------------------------------------------------------------------------
        Note: dy/dx for factor levels is the discrete change from the base level.
        
        .
        . qui margins, at(foreign=0) over(mpg)
        
        . marginsplot, noci xlab(15(5)40)
        
          Variables that uniquely identify margins: mpg _outcome
        Click image for larger version

Name:	Graph.png
Views:	1
Size:	86.9 KB
ID:	1432143
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          You asked for coefficients and got coefficients.

          In any case, the code is easily modified for AMEs:

          Code:
          margins, dydx(*)
          marginsplot, xdim(_predict) xlab(, novalue) xtitle("Outcome")

          Comment


          • #6
            Is it possible to generate marginal effects for all independent variables when (first) the DV(or rep78) is ==0, then (second) ==1, then ==3 and so on? The "mchange" can do that but its not easy to plot the results..

            Originally posted by Maarten Buis View Post
            Code:
            . sysuse auto, clear
            (1978 Automobile Data)
            
            . recode rep78 1/2=3
            (rep78: 10 changes made)
            
            . oprobit rep78 mpg i.foreign, nolog
            
            Ordered probit regression Number of obs = 69
            LR chi2(2) = 31.79
            Prob > chi2 = 0.0000
            Log likelihood = -50.299137 Pseudo R2 = 0.2401
            
            ------------------------------------------------------------------------------
            rep78 | Coef. Std. Err. z P>|z| [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            mpg | .0587834 .0299238 1.96 0.049 .0001337 .117433
            |
            foreign |
            Foreign | 1.44881 .3612085 4.01 0.000 .7408545 2.156766
            -------------+----------------------------------------------------------------
            /cut1 | 1.88242 .6278802 .6517976 3.113043
            /cut2 | 3.074515 .6987686 1.704953 4.444076
            ------------------------------------------------------------------------------
            
            . margins, dydx(*)
            
            Average marginal effects Number of obs = 69
            Model VCE : OIM
            
            dy/dx w.r.t. : mpg 1.foreign
            1._predict : Pr(rep78==3), predict(pr outcome(3))
            2._predict : Pr(rep78==4), predict(pr outcome(4))
            3._predict : Pr(rep78==5), predict(pr outcome(5))
            
            ------------------------------------------------------------------------------
            | Delta-method
            | dy/dx Std. Err. z P>|z| [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            mpg |
            _predict |
            1 | -.0163376 .0080357 -2.03 0.042 -.0320873 -.0005879
            2 | .0068833 .0037369 1.84 0.065 -.0004409 .0142075
            3 | .0094543 .0046804 2.02 0.043 .0002809 .0186277
            -------------+----------------------------------------------------------------
            0.foreign | (base outcome)
            -------------+----------------------------------------------------------------
            1.foreign |
            _predict |
            1 | -.506235 .1141719 -4.43 0.000 -.7300078 -.2824621
            2 | .1899206 .0686743 2.77 0.006 .0553214 .3245198
            3 | .3163143 .1013057 3.12 0.002 .1177588 .5148699
            ------------------------------------------------------------------------------
            Note: dy/dx for factor levels is the discrete change from the base level.
            
            .
            . qui margins, at(foreign=0) over(mpg)
            
            . marginsplot, noci xlab(15(5)40)
            
            Variables that uniquely identify margins: mpg _outcome
            [ATTACH=CONFIG]n1432143[/ATTACH]

            Comment


            • #7
              I have a similar problem, i want my ordered probit model to show all the coefficients of the dependent variable under each independent variable is this possible?

              Comment

              Working...
              X