Announcement

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

  • Help with mlogit and margins

    Hello guys! First, thank you for your help!

    I'm doing a mlogit + logit regression and then having the margins to interpreter the results.

    mlogit Y1 i.X1 i.X2 i.X3 i.X4 i.X5 i.X6, baseoutcome(3) r
    margins, dydx(*)

    mlogit Y2 i.X1 i.X2 i.X3 i.X4 i.X5 i.X6, r
    margins, dydx(*)
    The variable X1 take values 1 to 5. When I do the margins, the "value of reference" is when X1 = 1 but I want this when X1 = 3; I mean, I wanna the other values to be compared when X1 = 3 and not when X1 = 1.

    I can't find the command to do this.

    Could you help me? Thank you very much.



  • #2
    Use factor variable notation to specify the base level. See

    Code:
    help fvvarlist
    Code:
    webuse sysdsn1, clear
    qui mlogit insure age male nonwhite i.site
    margins, dydx(*)
    qui mlogit insure age male nonwhite ib3.site
    margins, dydx(*)
    Res.:

    Code:
    . qui mlogit insure age male nonwhite i.site
    
    . 
    . margins, dydx(*)
    
    Average marginal effects                        Number of obs     =        615
    Model VCE    : OIM
    
    dy/dx w.r.t. : age male nonwhite 2.site 3.site
    1._predict   : Pr(insure==Indemnity), predict(pr outcome(1))
    2._predict   : Pr(insure==Prepaid), predict(pr outcome(2))
    3._predict   : Pr(insure==Uninsure), predict(pr outcome(3))
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    age          |
        _predict |
              1  |   .0026655    .001399     1.91   0.057    -.0000765    .0054074
              2  |  -.0025142   .0013962    -1.80   0.072    -.0052507    .0002222
              3  |  -.0001512   .0007352    -0.21   0.837    -.0015923    .0012898
    -------------+----------------------------------------------------------------
    male         |
        _predict |
              1  |  -.1302604    .045513    -2.86   0.004    -.2194643   -.0410565
              2  |   .1177644   .0446537     2.64   0.008     .0302448     .205284
              3  |    .012496   .0231963     0.54   0.590    -.0329678    .0579599
    -------------+----------------------------------------------------------------
    nonwhite     |
        _predict |
              1  |  -.2060514   .0519716    -3.96   0.000    -.3079139    -.104189
              2  |   .2221527   .0500585     4.44   0.000     .1240398    .3202656
              3  |  -.0161013    .026312    -0.61   0.541    -.0676718    .0354693
    -------------+----------------------------------------------------------------
    1.site       |  (base outcome)
    -------------+----------------------------------------------------------------
    2.site       |
        _predict |
              1  |   .0070995   .0479993     0.15   0.882    -.0869775    .1011765
              2  |   .0608466   .0482687     1.26   0.207    -.0337583    .1554516
              3  |  -.0679461   .0241128    -2.82   0.005    -.1152064   -.0206859
    -------------+----------------------------------------------------------------
    3.site       |
        _predict |
              1  |   .1216165   .0505833     2.40   0.016      .022475     .220758
              2  |  -.1264342   .0491456    -2.57   0.010    -.2227579   -.0301105
              3  |   .0048177   .0314084     0.15   0.878    -.0567416     .066377
    ------------------------------------------------------------------------------
    Note: dy/dx for factor levels is the discrete change from the base level.
    
    . 
    . qui mlogit insure age male nonwhite ib3.site
    
    . 
    . margins, dydx(*)
    
    Average marginal effects                        Number of obs     =        615
    Model VCE    : OIM
    
    dy/dx w.r.t. : age male nonwhite 1.site 2.site
    1._predict   : Pr(insure==Indemnity), predict(pr outcome(1))
    2._predict   : Pr(insure==Prepaid), predict(pr outcome(2))
    3._predict   : Pr(insure==Uninsure), predict(pr outcome(3))
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    age          |
        _predict |
              1  |   .0026655    .001399     1.91   0.057    -.0000765    .0054074
              2  |  -.0025142   .0013962    -1.80   0.072    -.0052507    .0002222
              3  |  -.0001512   .0007352    -0.21   0.837    -.0015923    .0012898
    -------------+----------------------------------------------------------------
    male         |
        _predict |
              1  |  -.1302604    .045513    -2.86   0.004    -.2194643   -.0410565
              2  |   .1177644   .0446537     2.64   0.008     .0302448     .205284
              3  |    .012496   .0231963     0.54   0.590    -.0329678    .0579599
    -------------+----------------------------------------------------------------
    nonwhite     |
        _predict |
              1  |  -.2060514   .0519716    -3.96   0.000    -.3079139    -.104189
              2  |   .2221527   .0500585     4.44   0.000     .1240398    .3202656
              3  |  -.0161013    .026312    -0.61   0.541    -.0676718    .0354693
    -------------+----------------------------------------------------------------
    1.site       |
        _predict |
              1  |  -.1216165   .0505833    -2.40   0.016     -.220758    -.022475
              2  |   .1264342   .0491456     2.57   0.010     .0301105    .2227579
              3  |  -.0048177   .0314084    -0.15   0.878     -.066377    .0567416
    -------------+----------------------------------------------------------------
    2.site       |
        _predict |
              1  |   -.114517   .0496279    -2.31   0.021    -.2117859   -.0172481
              2  |   .1872808   .0482499     3.88   0.000     .0927127     .281849
              3  |  -.0727638    .025586    -2.84   0.004    -.1229115   -.0226162
    -------------+----------------------------------------------------------------
    3.site       |  (base outcome)
    ------------------------------------------------------------------------------
    Note: dy/dx for factor levels is the discrete change from the base level.
    
    .

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      Use factor variable notation to specify the base level. See

      Code:
      help fvvarlist
      Code:
      webuse sysdsn1, clear
      qui mlogit insure age male nonwhite i.site
      margins, dydx(*)
      qui mlogit insure age male nonwhite ib3.site
      margins, dydx(*)
      Res.:

      Code:
      . qui mlogit insure age male nonwhite i.site
      
      .
      . margins, dydx(*)
      
      Average marginal effects Number of obs = 615
      Model VCE : OIM
      
      dy/dx w.r.t. : age male nonwhite 2.site 3.site
      1._predict : Pr(insure==Indemnity), predict(pr outcome(1))
      2._predict : Pr(insure==Prepaid), predict(pr outcome(2))
      3._predict : Pr(insure==Uninsure), predict(pr outcome(3))
      
      ------------------------------------------------------------------------------
      | Delta-method
      | dy/dx Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      age |
      _predict |
      1 | .0026655 .001399 1.91 0.057 -.0000765 .0054074
      2 | -.0025142 .0013962 -1.80 0.072 -.0052507 .0002222
      3 | -.0001512 .0007352 -0.21 0.837 -.0015923 .0012898
      -------------+----------------------------------------------------------------
      male |
      _predict |
      1 | -.1302604 .045513 -2.86 0.004 -.2194643 -.0410565
      2 | .1177644 .0446537 2.64 0.008 .0302448 .205284
      3 | .012496 .0231963 0.54 0.590 -.0329678 .0579599
      -------------+----------------------------------------------------------------
      nonwhite |
      _predict |
      1 | -.2060514 .0519716 -3.96 0.000 -.3079139 -.104189
      2 | .2221527 .0500585 4.44 0.000 .1240398 .3202656
      3 | -.0161013 .026312 -0.61 0.541 -.0676718 .0354693
      -------------+----------------------------------------------------------------
      1.site | (base outcome)
      -------------+----------------------------------------------------------------
      2.site |
      _predict |
      1 | .0070995 .0479993 0.15 0.882 -.0869775 .1011765
      2 | .0608466 .0482687 1.26 0.207 -.0337583 .1554516
      3 | -.0679461 .0241128 -2.82 0.005 -.1152064 -.0206859
      -------------+----------------------------------------------------------------
      3.site |
      _predict |
      1 | .1216165 .0505833 2.40 0.016 .022475 .220758
      2 | -.1264342 .0491456 -2.57 0.010 -.2227579 -.0301105
      3 | .0048177 .0314084 0.15 0.878 -.0567416 .066377
      ------------------------------------------------------------------------------
      Note: dy/dx for factor levels is the discrete change from the base level.
      
      .
      . qui mlogit insure age male nonwhite ib3.site
      
      .
      . margins, dydx(*)
      
      Average marginal effects Number of obs = 615
      Model VCE : OIM
      
      dy/dx w.r.t. : age male nonwhite 1.site 2.site
      1._predict : Pr(insure==Indemnity), predict(pr outcome(1))
      2._predict : Pr(insure==Prepaid), predict(pr outcome(2))
      3._predict : Pr(insure==Uninsure), predict(pr outcome(3))
      
      ------------------------------------------------------------------------------
      | Delta-method
      | dy/dx Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      age |
      _predict |
      1 | .0026655 .001399 1.91 0.057 -.0000765 .0054074
      2 | -.0025142 .0013962 -1.80 0.072 -.0052507 .0002222
      3 | -.0001512 .0007352 -0.21 0.837 -.0015923 .0012898
      -------------+----------------------------------------------------------------
      male |
      _predict |
      1 | -.1302604 .045513 -2.86 0.004 -.2194643 -.0410565
      2 | .1177644 .0446537 2.64 0.008 .0302448 .205284
      3 | .012496 .0231963 0.54 0.590 -.0329678 .0579599
      -------------+----------------------------------------------------------------
      nonwhite |
      _predict |
      1 | -.2060514 .0519716 -3.96 0.000 -.3079139 -.104189
      2 | .2221527 .0500585 4.44 0.000 .1240398 .3202656
      3 | -.0161013 .026312 -0.61 0.541 -.0676718 .0354693
      -------------+----------------------------------------------------------------
      1.site |
      _predict |
      1 | -.1216165 .0505833 -2.40 0.016 -.220758 -.022475
      2 | .1264342 .0491456 2.57 0.010 .0301105 .2227579
      3 | -.0048177 .0314084 -0.15 0.878 -.066377 .0567416
      -------------+----------------------------------------------------------------
      2.site |
      _predict |
      1 | -.114517 .0496279 -2.31 0.021 -.2117859 -.0172481
      2 | .1872808 .0482499 3.88 0.000 .0927127 .281849
      3 | -.0727638 .025586 -2.84 0.004 -.1229115 -.0226162
      -------------+----------------------------------------------------------------
      3.site | (base outcome)
      ------------------------------------------------------------------------------
      Note: dy/dx for factor levels is the discrete change from the base level.
      
      .
      I think it worked! Thank you very much! You solved my doubt!

      Regards,
      Rubén L

      Comment

      Working...
      X