Announcement

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

  • Cannot evaluate a nlcom ratio after an mlogit estimation

    Hi all,

    I am trying to get a valuation of a nonlinear expression of my estimated parameters from a mlogit model

    . mlogit OS3 A1 North Central South Biol TG Mod Maj ASC ASCConcern Q3Concern, noconstant vce(robust)

    The model is estimated and the results are tabulated. Then I want to assess the ratio of the coefficient of TG with that of A1. Namely the coefficient of TG over the coefficient of A1.
    I went to the post estimation link or in the command

    .nlcom (WTP: _b[TG]/_b[A1]), post

    STATA does not provide statistics of the ratio but informs me the following

    expression (_b[TG]/_b[A1]) evaluates to missing
    r(498);

    It seems to me that the coefficients are not stored. Since display _b[TG]
    yields 0

    Any help will be appreciated.

    Peter

  • #2
    that is not the correct syntax if I understand correctly what you want - see the last example in the -nlcom- help file which is an -mlogit- example; if you want specific code, you need to provide the exact output (within CODE blocks); see the FAQ.

    Comment


    • #3
      More generally, when using post-estimation commands after any estimation command, you need to use the correct names for the coefficients you want to use. In particular, after -mlogit- there is no coefficient named _b[TG]. If you think about what an -mlogit- model does, that will be clear to you: there will be several coefficients of TG, one correspond to each level of the outcome variable except for the base level. It gets complicated because different regression commands use different ways of naming the coefficients in the _b[] matrix. And sometimes they change when new versions of Stata are released. To find the correct names to use, replay the estimation command specifying the -coefl- option. For instance:
      Code:
      . sysuse auto, clear
      (1978 automobile data)
      
      .
      . regress price mpg i.foreign headroom
      
            Source |       SS           df       MS      Number of obs   =        74
      -------------+----------------------------------   F(3, 70)        =      9.35
             Model |   181731905         3  60577301.6   Prob > F        =    0.0000
          Residual |   453333491        70  6476192.73   R-squared       =    0.2862
      -------------+----------------------------------   Adj R-squared   =    0.2556
             Total |   635065396        73  8699525.97   Root MSE        =    2544.8
      
      ------------------------------------------------------------------------------
             price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
               mpg |  -303.8203   59.52956    -5.10   0.000    -422.5483   -185.0924
                   |
           foreign |
          Foreign  |   1714.109   712.7945     2.40   0.019     292.4855    3135.733
          headroom |  -186.5669   391.5667    -0.48   0.635    -967.5221    594.3883
             _cons |   12684.65   2007.966     6.32   0.000     8679.887    16689.41
      ------------------------------------------------------------------------------
      
      . regress, coefl
      
            Source |       SS           df       MS      Number of obs   =        74
      -------------+----------------------------------   F(3, 70)        =      9.35
             Model |   181731905         3  60577301.6   Prob > F        =    0.0000
          Residual |   453333491        70  6476192.73   R-squared       =    0.2862
      -------------+----------------------------------   Adj R-squared   =    0.2556
             Total |   635065396        73  8699525.97   Root MSE        =    2544.8
      
      ------------------------------------------------------------------------------
             price | Coefficient  Legend
      -------------+----------------------------------------------------------------
               mpg |  -303.8203  _b[mpg]
                   |
           foreign |
          Foreign  |   1714.109  _b[1.foreign]
          headroom |  -186.5669  _b[headroom]
             _cons |   12684.65  _b[_cons]
      ------------------------------------------------------------------------------
      
      .
      . mlogit rep78 price mpg
      
      Iteration 0:  Log likelihood = -93.692061  
      Iteration 1:  Log likelihood = -84.981843  
      Iteration 2:  Log likelihood = -83.773089  
      Iteration 3:  Log likelihood = -83.699686  
      Iteration 4:  Log likelihood = -83.697887  
      Iteration 5:  Log likelihood = -83.697882  
      
      Multinomial logistic regression                         Number of obs =     69
                                                              LR chi2(8)    =  19.99
                                                              Prob > chi2   = 0.0104
      Log likelihood = -83.697882                             Pseudo R2     = 0.1067
      
      ------------------------------------------------------------------------------
             rep78 | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      1            |
             price |  -.0006468    .000849    -0.76   0.446    -.0023108    .0010173
               mpg |  -.0197512   .1959898    -0.10   0.920     -.403884    .3643817
             _cons |   1.013462   6.695433     0.15   0.880    -12.10935    14.13627
      -------------+----------------------------------------------------------------
      2            |
             price |  -.0001017    .000177    -0.57   0.566    -.0004486    .0002452
               mpg |  -.0527552   .1153556    -0.46   0.647    -.2788479    .1733375
             _cons |   .3244272   2.936738     0.11   0.912    -5.431474    6.080328
      -------------+----------------------------------------------------------------
      3            |  (base outcome)
      -------------+----------------------------------------------------------------
      4            |
             price |   .0000517   .0001216     0.42   0.671    -.0001867    .0002901
               mpg |   .1113209   .0732537     1.52   0.129    -.0322538    .2548955
             _cons |  -3.112858   2.024444    -1.54   0.124    -7.080695    .8549794
      -------------+----------------------------------------------------------------
      5            |
             price |    .000228   .0001562     1.46   0.144    -.0000781    .0005342
               mpg |   .2993637   .0907369     3.30   0.001     .1215226    .4772049
             _cons |   -9.22122    2.79555    -3.30   0.001     -14.7004   -3.742042
      ------------------------------------------------------------------------------
      
      . mlogit, coefl
      
      Multinomial logistic regression                         Number of obs =     69
                                                              LR chi2(8)    =  19.99
                                                              Prob > chi2   = 0.0104
      Log likelihood = -83.697882                             Pseudo R2     = 0.1067
      
      ------------------------------------------------------------------------------
             rep78 | Coefficient  Legend
      -------------+----------------------------------------------------------------
      1            |
             price |  -.0006468  _b[1:price]
               mpg |  -.0197512  _b[1:mpg]
             _cons |   1.013462  _b[1:_cons]
      -------------+----------------------------------------------------------------
      2            |
             price |  -.0001017  _b[2:price]
               mpg |  -.0527552  _b[2:mpg]
             _cons |   .3244272  _b[2:_cons]
      -------------+----------------------------------------------------------------
      3            |  (base outcome)
      -------------+----------------------------------------------------------------
      4            |
             price |   .0000517  _b[4:price]
               mpg |   .1113209  _b[4:mpg]
             _cons |  -3.112858  _b[4:_cons]
      -------------+----------------------------------------------------------------
      5            |
             price |    .000228  _b[5:price]
               mpg |   .2993637  _b[5:mpg]
             _cons |   -9.22122  _b[5:_cons]
      ------------------------------------------------------------------------------
      You have to use the names that -coefl- shows you in order for the post-estimation commands to work correctly.

      Comment


      • #4
        Thank you both. Appreciated your help.

        Comment

        Working...
        X