Announcement

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

  • xtmlogit pwcompare and contrast postestimation error Stata17

    panel multinomial logit model was introduced in Stata 17, however, I'm having issues using the pwcompare and contrast postestimation commands after fitting an xtmlogit model. Can someone please suggest why I'm having this error or is it that what I'm attempting is not practically possible or being done in the wrong way.

    Code:
    webuse estatus, clear
    xtset id
    xtmlogit estatus i.hhchild age hhincome i.hhsigno i.bwinner
    contrast hhchild
    I get the r(3200) error message - something to do with the matrix:
    Code:
     *:  3200  conformability error
                 _contrast():     -  function returned error
                     <istmt>:     -  function returned error


  • #2
    I am running into the exact same problem after running xtmlogit and getting my results. Pwcompare and Contrast appear in the postestimation list for xtmlogit, however, the same error always appears. I am working with Stata/SE 17.0 for Mac.

    Were you able to find a solution to the error?

    Thank you.

    Alejandra

    Comment


    • #3
      Hi Alejandra and Madu,

      Thank you for bringing this to our attention. This is a bug that we will fix in a future update. We apologize for the inconvenience.

      In the meantime, the bug is related to the estimability check contrast is performing. Thus, if you know that your contrasts are well defined, you can get around this problem by bypassing that check using the noestimcheck option. Here is an example:


      Code:
      . webuse estatus, clear
      (Fictional employment status data)
      
      . xtset id
      
      Panel variable: id (unbalanced)
      
      . xtmlogit estatus i.hhchild age hhincome i.hhsigno i.bwinner
      
      Fitting comparison model ...
      
      Refining starting values:
      
      Grid node 0:   log likelihood = -4483.1721
      Grid node 1:   log likelihood = -4516.6753
      
      Fitting full model:
      
      Iteration 0:   log likelihood = -4483.1721  
      Iteration 1:   log likelihood = -4474.3849  
      Iteration 2:   log likelihood = -4468.9353  
      Iteration 3:   log likelihood = -4468.8415  
      Iteration 4:   log likelihood = -4468.8413  
      
      Random-effects multinomial logistic regression       Number of obs    =  4,761
      Group variable: id                                   Number of groups =    800
      
      Random effects u_i ~ Gaussian                        Obs per group:
                                                                        min =      5
                                                                        avg =    6.0
                                                                        max =      7
      
      Integration method: mvaghermite                      Integration pts. =      7
      
                                                           Wald chi2(10)    = 239.26
      Log likelihood = -4468.8413                          Prob > chi2      = 0.0000
      
      ------------------------------------------------------------------------------------
                 estatus | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------------+----------------------------------------------------------------
      Out_of_labor_force |
                 hhchild |
                    Yes  |   .4628125   .0962758     4.81   0.000     .2741154    .6515096
                     age |   -.004825   .0066428    -0.73   0.468    -.0178446    .0081946
                hhincome |  -.0046922    .001839    -2.55   0.011    -.0082965   -.0010879
                         |
                 hhsigno |
                    Yes  |   .4967056   .0946442     5.25   0.000     .3112063    .6822049
                         |
                 bwinner |
                    Yes  |  -.4740919   .0727992    -6.51   0.000    -.6167756   -.3314082
                   _cons |  -.4787579   .2845139    -1.68   0.092    -1.036395    .0788792
      -------------------+----------------------------------------------------------------
      Unemployed         |
                 hhchild |
                    Yes  |  -.0401989    .119596    -0.34   0.737    -.2746027    .1942049
                     age |   .0042644   .0081818     0.52   0.602    -.0117716    .0203004
                hhincome |  -.0308468   .0026529   -11.63   0.000    -.0360463   -.0256473
                         |
                 hhsigno |
                    Yes  |      .0968   .1192659     0.81   0.417    -.1369568    .3305568
                         |
                 bwinner |
                    Yes  |  -.2252587   .0951984    -2.37   0.018    -.4118441   -.0386733
                   _cons |  -.0953821   .3508736    -0.27   0.786    -.7830817    .5923175
      -------------------+----------------------------------------------------------------
      Employed           |  (base outcome)
      -------------------+----------------------------------------------------------------
                  var(u1)|   .8587807   .1090216                      .6696113    1.101392
                  var(u2)|   .7370366   .1388917                      .5094287    1.066338
      ------------------------------------------------------------------------------------
      LR test vs. multinomial logit: chi2(2) = 225.31           Prob > chi2 = 0.0000
      
      Note: LR test is conservative and provided only for reference.
      
      . contrast hhchild, noestimcheck
      
      Contrasts of marginal linear predictions
      
      Margins: asbalanced
      
      ------------------------------------------------
                   |         df        chi2     P>chi2
      -------------+----------------------------------
      Out_of_lab~e |
           hhchild |          1       23.11     0.0000
      ------------------------------------------------
      
      . contrast hhchild, equation(Unemployed) noestimcheck
      
      Contrasts of marginal linear predictions
      
      Margins: asbalanced
      
      ------------------------------------------------
                   |         df        chi2     P>chi2
      -------------+----------------------------------
      Unemployed   |
           hhchild |          1        0.11     0.7368
      ------------------------------------------------
      I hope this helps.

      Best,
      Joerg
      Last edited by Joerg Luedicke (StataCorp); 04 Aug 2022, 15:56.

      Comment

      Working...
      X