Announcement

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

  • Speed: Report margins dydx(*) at means with panel clogit

    Hi there, I am trying to report the margins at means for a FE logit (clogit) model.

    When I type "margins, dydx(*) atmeans" it never loads and I just get a spinning wheel.

    Is there a way of overcoming this?

    See code, below:

    clogit poor_health overdebt $all_debt $L_all_debt clean_age agesq $eduvars couple bad_physical lntot_inc urban, or group(pid) robust
    margins, dydx (*) atmeans

    I am currently reporting odds ratios instead, but I would like to have a marginal effect for interpretation purposes.

  • #2
    You will have to provide a minimal example of data and show it with -dataex-, and then show what output containing the problem you get back from Stata.

    Because with the example dataset for the command, one does not obtain "a spinning wheel."

    Code:
    . webuse lowbirth2, clear
    (Applied Logistic Regression, Hosmer & Lemeshow)
    
    . clogit low lwt smoke ptd ht ui i.race, group(pairid) nolog
    
    Conditional (fixed-effects) logistic regression
    
                                                    Number of obs     =        112
                                                    LR chi2(7)        =      26.04
                                                    Prob > chi2       =     0.0005
    Log likelihood = -25.794271                     Pseudo R2         =     0.3355
    
    ------------------------------------------------------------------------------
             low |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             lwt |  -.0183757   .0100806    -1.82   0.068    -.0381333    .0013819
           smoke |   1.400656   .6278396     2.23   0.026     .1701131    2.631199
             ptd |   1.808009   .7886502     2.29   0.022     .2622828    3.353735
              ht |   2.361152   1.086128     2.17   0.030     .2323796    4.489924
              ui |   1.401929   .6961585     2.01   0.044     .0374836    2.766375
                 |
            race |
          black  |   .5713643    .689645     0.83   0.407    -.7803149    1.923044
          other  |  -.0253148   .6992044    -0.04   0.971     -1.39573    1.345101
    ------------------------------------------------------------------------------
    
    . margins, dydx (*) atmeans
    
    Conditional marginal effects                    Number of obs     =        112
    Model VCE    : OIM
    
    Expression   : Pr(low|fixed effect is 0), predict(pu0)
    dy/dx w.r.t. : lwt smoke ptd ht ui 2.race 3.race
    at           : lwt             =    127.1696 (mean)
                   smoke           =    .4107143 (mean)
                   ptd             =    .2232143 (mean)
                   ht              =    .0892857 (mean)
                   ui              =    .1785714 (mean)
                   1.race          =    .3928571 (mean)
                   2.race          =       .1875 (mean)
                   3.race          =    .4196429 (mean)
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             lwt |  -.0039303   .0009467    -4.15   0.000    -.0057858   -.0020748
           smoke |   .2995783   .2503767     1.20   0.231     -.191151    .7903075
             ptd |   .3867045   .2712309     1.43   0.154    -.1448983    .9183074
              ht |   .5050131   .2945989     1.71   0.086    -.0723902    1.082416
              ui |   .2998505   .2216245     1.35   0.176    -.1345256    .7342266
                 |
            race |
          black  |   .1296423   .1709427     0.76   0.448    -.2053992    .4646838
          other  |  -.0051813   .1409953    -0.04   0.971    -.2815271    .2711645
    ------------------------------------------------------------------------------
    Note: dy/dx for factor levels is the discrete change from the base level.

    Comment


    • #3
      Joro Kolev thank you. It seems to be working now.

      I initially encountered this error using xtlogit, but now with clogit it seems to be smoother

      Attached Files

      Comment

      Working...
      X