Announcement

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

  • not concave, multinomial logit

    I am running a multinomial logit with mostly dummy variables. These variables are constructed manually, by
    Code:
    tab x, gen (xa)
    [CODE]. My regression code is the following

    Code:
    mlogit cond_empleo trans2 trans3 trans4 trans5 trans6 l2 l3 l4 l5 l6 l7 l8 casado_unido separado divorciado viudo mujer  dumarea lnincome e1519 e2024 e2529 e3539 e4044 e4549 e5054 e5559 e6064 regiones1 regiones2 regiones3 sector2 sector3 tri1 tri2 tri3 tri4 tri5 tri6 tri7 tri8 tri9 tri10 tri11 , vce(robust)
    but this happened


    Code:
    Iteration 9605: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9606: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9607: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9608: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9609: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9610: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9611: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9612: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9613: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9614: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9615: log pseudolikelihood = -65080.449  (not concave)
    Iteration 9616: log pseudolikelihood = -65080.449  (not concave)
    Any ideas?

  • #2
    The -mlogit- command you posted cannot be what you ran: 12, 13, 14, 15, 16, 17, and 18 are not legal variable names, and on encountering them, -mlogit- will give you an "invalid name" error message. So you need to show us exactly what you did run. To be sure you get it exact, copy from your Results window or log file and paste directly into a code block here. Don't edit in any way: all details are important.

    There is no apparent connection between your manually constructed indicator (dummy) variables and your mologit command: they do not appear anywhere in it. So why do you bring that up?

    In general, when the likelihood function is not concave, it most often means that the model is unidentified: that there are two or more parameters in your model whose values could exhibit some tradeoff between them that leaves everything unchanged. If you can think of what those variables might be, trying again omitting one of them would be your best bet. If you cannot think of any such situation, then you will have to just do some experimentation. Generally it is best to start with a very simple model containing only a one or two variables, and then add in new variables one at a time until you hit your problem. Then you'll know at least one of the problematic variables.

    Finally, though it has nothing to do with the problem you are encountering, in modern Stata it makes no sense to create your own indicator variables. You should let Stata do that by using factor variable notation. (See -help fvvarlist-.) In addition to the xa variables, some of the variables in your -mlogit- command appear to also be indicator variables, e.g. casado_unido, separado, divorciado, regiones 1-3, sector2, sector3. If they are, you are better off creating a single variable: marital status coded 1/2/3 and using factor variable notation with that.

    The big advantage of using factor variable notation is that you will then be able to use the -margins- command to generated predicted probabilities. And, to be honest, -mlogit- models are so complicated from that perspective, I don't know how anybody ever managed to understand them before we had -margins-.

    Comment


    • #3
      Clyde I changed the way I was doing it, I used factor variable notation to most of my variables, but now I cannot get the margins

      this is my code now

      Code:
      mlogit cond_empleo i.trans i.trimestre l2 l3 l4 l5 l6 l7 l8 mujer dumarea i.region i.sectores i.s07p18 , noconstant vce(cluster cid)
      **by the way the variables are not 12 (twelve) is a L and a 2 is from LEVEL

      this are the results:

      Code:
      Iteration 0:   log pseudolikelihood = -287292.51  
      Iteration 1:   log pseudolikelihood = -158038.99  
      Iteration 2:   log pseudolikelihood = -134865.56  
      Iteration 3:   log pseudolikelihood = -131706.62  
      Iteration 4:   log pseudolikelihood =  -131184.6  
      Iteration 5:   log pseudolikelihood = -131084.85  
      Iteration 6:   log pseudolikelihood = -131066.07  
      Iteration 7:   log pseudolikelihood = -131063.61  
      Iteration 8:   log pseudolikelihood = -131063.08  
      Iteration 9:   log pseudolikelihood = -131062.95  
      Iteration 10:  log pseudolikelihood = -131062.92  
      Iteration 11:  log pseudolikelihood = -131062.91  
      Iteration 12:  log pseudolikelihood = -131062.91  
      Iteration 13:  log pseudolikelihood = -131062.91  
      Iteration 14:  log pseudolikelihood = -131062.91  
      Iteration 15:  log pseudolikelihood = -131062.91  
      
      Multinomial logistic regression                 Number of obs     =    160,341
                                                      Wald chi2(165)    = 1811772.06
      Log pseudolikelihood = -131062.91               Prob > chi2       =     0.0000
      
                                                (Std. Err. adjusted for 56,426 clusters in cid)
      -----------------------------------------------------------------------------------------
                              |               Robust
                  cond_empleo |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      ------------------------+----------------------------------------------------------------
      formal_empleado         |
                        trans |
        formal cuenta propia  |  -3.278242   .5826373    -5.63   0.000     -4.42019   -2.136294
           informal empleado  |  -5.790522   .0609492   -95.01   0.000     -5.90998   -5.671063
      informal cuenta propia  |  -5.865816    .073304   -80.02   0.000     -6.00949   -5.722143
                   desempleo  |  -5.070528    .075007   -67.60   0.000    -5.217539   -4.923517
                 inactividad  |  -5.920703   .0758897   -78.02   0.000    -6.069444   -5.771961
                              |
                    trimestre |
                       20103  |  -.9032073   .0721586   -12.52   0.000    -1.044635   -.7617791
                       20104  |  -1.089821   .0722187   -15.09   0.000    -1.231367   -.9482746
                       20111  |  -.9464516    .071316   -13.27   0.000    -1.086228   -.8066748
                       20112  |  -.9687415   .0742168   -13.05   0.000    -1.114204   -.8232793
                       20113  |  -.9407658    .073647   -12.77   0.000    -1.085111   -.7964203
                       20114  |  -.9844333   .0746693   -13.18   0.000    -1.130782   -.8380842
                       20121  |  -.9743291     .07413   -13.14   0.000    -1.119621   -.8290369
                       20122  |  -.9673511   .0738189   -13.10   0.000    -1.112034   -.8226687
                       20123  |  -1.107581    .075099   -14.75   0.000    -1.254772   -.9603897
                       20124  |  -1.102684   .0734346   -15.02   0.000    -1.246614   -.9587551
                              |
                           l2 |   2.031543   .1300935    15.62   0.000     1.776564    2.286521
                           l3 |   2.186316   .1309429    16.70   0.000     1.929673    2.442959
                           l4 |   2.311247   .1298451    17.80   0.000     2.056755    2.565739
                           l5 |   2.880794   .1324325    21.75   0.000     2.621231    3.140357
                           l6 |   3.442815   .1335112    25.79   0.000     3.181138    3.704493
                           l7 |   3.800115   .1344048    28.27   0.000     3.536686    4.063544
                           l8 |    4.22888   .2332304    18.13   0.000     3.771757    4.686003
                        mujer |   -.326763   .0310599   -10.52   0.000    -.3876393   -.2658867
                      dumarea |   .3264164   .0479099     6.81   0.000     .2325149     .420318
                              |
                       region |
                     central  |   .1809194   .0483436     3.74   0.000     .0861676    .2756712
                   atlantico  |  -.0312634   .0689344    -0.45   0.650    -.1663723    .1038455
                           4  |   .5889213   .0429556    13.71   0.000       .50473    .6731127
                              |
                     sectores |
                           2  |   2.877435   .0964207    29.84   0.000     2.688454    3.066416
                           3  |   1.774824   .0946469    18.75   0.000      1.58932    1.960329
                              |
                       s07p18 |
                 separado(a)  |  -.1168402   .0434727    -2.69   0.007    -.2020452   -.0316352
               divorciado(a)  |   .0786313    .149494     0.53   0.599    -.2143715    .3716341
                    viudo(a)  |   .3691327   .1405602     2.63   0.009     .0936398    .6446256
                  soltero(a)  |    -.85052   .0353997   -24.03   0.000    -.9199022   -.7811379
      ------------------------+----------------------------------------------------------------
      formal_cuenta_propia    |
                        trans |
        formal cuenta propia  |   4.304919   .6099135     7.06   0.000      3.10951    5.500327
           informal empleado  |  -5.295709   .4596832   -11.52   0.000    -6.196671   -4.394746
      informal cuenta propia  |    -2.8864   .2893742    -9.97   0.000    -3.453563   -2.319237
                   desempleo  |  -18.07754    .209549   -86.27   0.000    -18.48825   -17.66683
                 inactividad  |  -3.475788   .5501463    -6.32   0.000    -4.554055   -2.397522
                              |
                    trimestre |
                       20103  |  -3.642674   .7150358    -5.09   0.000    -5.044118   -2.241229
                       20104  |   -1.20868   .3138609    -3.85   0.000    -1.823836   -.5935235
                       20111  |  -1.549557   .4381893    -3.54   0.000    -2.408392   -.6907216
                       20112  |  -2.256326   .6149457    -3.67   0.000    -3.461598   -1.051055
                       20113  |  -2.770175   .4642405    -5.97   0.000     -3.68007   -1.860281
                       20114  |  -1.526248   .4250802    -3.59   0.000     -2.35939   -.6931056
                       20121  |  -1.530631   .3997504    -3.83   0.000    -2.314128   -.7471351
                       20122  |  -2.571469     .43837    -5.87   0.000    -3.430658   -1.712279
                       20123  |  -1.882331   .4175377    -4.51   0.000     -2.70069   -1.063972
                       20124  |  -2.010246   .4592915    -4.38   0.000    -2.910441   -1.110051
                              |
                           l2 |  -1.380595   .5478082    -2.52   0.012    -2.454279   -.3069102
                           l3 |  -1.609259   .4499084    -3.58   0.000    -2.491063   -.7274549
                           l4 |  -1.599975   .3888562    -4.11   0.000     -2.36212   -.8378312
                           l5 |   -1.10852   .4353478    -2.55   0.011    -1.961786   -.2552539
                           l6 |  -1.551727   .6834406    -2.27   0.023    -2.891246   -.2122083
                           l7 |   1.000866   .2382565     4.20   0.000     .5338922     1.46784
                           l8 |   1.449751   .6153592     2.36   0.018     .2436689    2.655833
                        mujer |  -1.097524   .2945492    -3.73   0.000     -1.67483   -.5202178
                      dumarea |  -.8839586   .3774785    -2.34   0.019    -1.623803   -.1441143
                              |
                       region |
                     central  |  -1.039968   .3479767    -2.99   0.003     -1.72199   -.3579462
                   atlantico  |    -1.4257   1.011592    -1.41   0.159    -3.408384    .5569847
                           4  |   .1831966   .2712241     0.68   0.499    -.3483929     .714786
                              |
                     sectores |
                           2  |   .5660053   .4574686     1.24   0.216    -.3306168    1.462627
                           3  |    .623281   .2974911     2.10   0.036     .0402091    1.206353
                              |
                       s07p18 |
                 separado(a)  |  -1.585925   .5721166    -2.77   0.006    -2.707253   -.4645969
               divorciado(a)  |  -.0779355   1.018229    -0.08   0.939    -2.073627    1.917756
                    viudo(a)  |   1.040921   .5786799     1.80   0.072    -.0932705    2.175113
                  soltero(a)  |  -2.039022   .4831184    -4.22   0.000    -2.985916   -1.092127
      ------------------------+----------------------------------------------------------------
      informal_empleado       |  (base outcome)
      ------------------------+----------------------------------------------------------------
      informal_cuenta_propia  |
                        trans |
        formal cuenta propia  |   1.843507    .529641     3.48   0.001       .80543    2.881585
           informal empleado  |  -.9968326   .0460421   -21.65   0.000    -1.087073   -.9065918
      informal cuenta propia  |   1.903903   .0460903    41.31   0.000     1.813568    1.994238
                   desempleo  |   -.004855   .0590191    -0.08   0.934    -.1205303    .1108204
                 inactividad  |   .1291165   .0515745     2.50   0.012     .0280323    .2302006
                              |
                    trimestre |
                       20103  |  -.0693275   .0417545    -1.66   0.097    -.1511647    .0125098
                       20104  |  -.1167143      .0392    -2.98   0.003    -.1935448   -.0398837
                       20111  |  -.0778783   .0397058    -1.96   0.050    -.1557002   -.0000563
                       20112  |  -.0113022    .040449    -0.28   0.780    -.0905808    .0679765
                       20113  |    .013589   .0403797     0.34   0.736    -.0655538    .0927317
                       20114  |  -.0257326   .0404654    -0.64   0.525    -.1050433    .0535782
                       20121  |  -.1807264   .0409854    -4.41   0.000    -.2610564   -.1003964
                       20122  |   .0064652   .0408829     0.16   0.874    -.0736638    .0865942
                       20123  |    .000774   .0404586     0.02   0.985    -.0785234    .0800714
                       20124  |  -.0012077   .0399683    -0.03   0.976    -.0795442    .0771287
                              |
                           l2 |  -.1828087   .0276742    -6.61   0.000    -.2370491   -.1285683
                           l3 |  -.3447644   .0315622   -10.92   0.000    -.4066252   -.2829036
                           l4 |  -.5148528   .0312643   -16.47   0.000    -.5761297   -.4535758
                           l5 |  -.5390253   .0374945   -14.38   0.000    -.6125132   -.4655374
                           l6 |  -.4423558   .0448121    -9.87   0.000    -.5301859   -.3545257
                           l7 |  -.2400527   .0511346    -4.69   0.000    -.3402747   -.1398307
                           l8 |  -.5841021   .1978508    -2.95   0.003    -.9718825   -.1963217
                        mujer |  -.1313699   .0186357    -7.05   0.000    -.1678951   -.0948447
                      dumarea |  -.1580111   .0234042    -6.75   0.000    -.2038825   -.1121397
                              |
                       region |
                     central  |  -.0048842    .022545    -0.22   0.828    -.0490716    .0393032
                   atlantico  |  -.0070826   .0289831    -0.24   0.807    -.0638883    .0497232
                           4  |   .0338355    .024649     1.37   0.170    -.0144756    .0821465
                              |
                     sectores |
                           2  |    .260183   .0386943     6.72   0.000     .1843434    .3360225
                           3  |   .3224125    .027612    11.68   0.000      .268294     .376531
                              |
                       s07p18 |
                 separado(a)  |  -.2736972   .0241341   -11.34   0.000    -.3209992   -.2263952
               divorciado(a)  |   .1053257   .1111357     0.95   0.343    -.1124962    .3231476
                    viudo(a)  |   .2920922   .0677183     4.31   0.000     .1593667    .4248177
                  soltero(a)  |  -1.250594    .022609   -55.31   0.000    -1.294907   -1.206281
      ------------------------+----------------------------------------------------------------
      desempleo               |
                        trans |
        formal cuenta propia  |  -2.347423   1.099012    -2.14   0.033    -4.501446   -.1933994
           informal empleado  |  -3.194726   .0576023   -55.46   0.000    -3.307624   -3.081828
      informal cuenta propia  |  -2.267735   .0620896   -36.52   0.000    -2.389428   -2.146041
                   desempleo  |  -.7976626   .0642645   -12.41   0.000    -.9236187   -.6717064
                 inactividad  |   -1.50952   .0613525   -24.60   0.000    -1.629769   -1.389271
                              |
                    trimestre |
                       20103  |  -.8161765   .0543209   -15.03   0.000    -.9226436   -.7097095
                       20104  |  -.9886287   .0543799   -18.18   0.000    -1.095211    -.882046
                       20111  |  -.9198598   .0544656   -16.89   0.000     -1.02661   -.8131093
                       20112  |  -.9897716   .0566057   -17.49   0.000    -1.100717   -.8788265
                       20113  |  -1.118889   .0581218   -19.25   0.000    -1.232806   -1.004972
                       20114  |   -.963528   .0560921   -17.18   0.000    -1.073466   -.8535895
                       20121  |  -.8845524   .0549565   -16.10   0.000    -.9922652   -.7768395
                       20122  |  -.9134827   .0557982   -16.37   0.000    -1.022845   -.8041203
                       20123  |  -1.049592   .0568317   -18.47   0.000     -1.16098   -.9382037
                       20124  |  -1.159392   .0582767   -19.89   0.000    -1.273613   -1.045172
                              |
                           l2 |  -.6672081   .0523513   -12.74   0.000    -.7698148   -.5646015
                           l3 |  -.8030252   .0559954   -14.34   0.000     -.912774   -.6932763
                           l4 |  -.7140032    .049545   -14.41   0.000    -.8111095   -.6168968
                           l5 |  -.5506096   .0546779   -10.07   0.000    -.6577762   -.4434429
                           l6 |  -.3168526   .0581002    -5.45   0.000    -.4307269   -.2029783
                           l7 |   -.252989   .0670906    -3.77   0.000    -.3844841   -.1214939
                           l8 |  -.9711893   .2950432    -3.29   0.001    -1.549463   -.3929152
                        mujer |  -.3449822   .0298235   -11.57   0.000    -.4034352   -.2865293
                      dumarea |  -.2452202   .0391376    -6.27   0.000    -.3219284    -.168512
                              |
                       region |
                     central  |  -.4341632   .0401205   -10.82   0.000    -.5127979   -.3555286
                   atlantico  |  -.7326256   .0691709   -10.59   0.000    -.8681982   -.5970531
                           4  |   -.141679    .033383    -4.24   0.000    -.2071085   -.0762495
                              |
                     sectores |
                           2  |  -18.63649   .0489532  -380.70   0.000    -18.73244   -18.54055
                           3  |   2.826625   .0461434    61.26   0.000     2.736186    2.917065
                              |
                       s07p18 |
                 separado(a)  |  -.0241877   .0402911    -0.60   0.548    -.1031568    .0547814
               divorciado(a)  |  -.1624404   .1880666    -0.86   0.388    -.5310443    .2061634
                    viudo(a)  |   -.503783   .1567965    -3.21   0.001    -.8110985   -.1964675
                  soltero(a)  |   -.136507   .0325509    -4.19   0.000    -.2003055   -.0727085
      ------------------------+----------------------------------------------------------------
      inactividad             |
                        trans |
        formal cuenta propia  |  -2.100156   .8101579    -2.59   0.010    -3.688036   -.5122755
           informal empleado  |  -3.111794   .0485521   -64.09   0.000    -3.206955   -3.016634
      informal cuenta propia  |  -2.098218    .051246   -40.94   0.000    -2.198659   -1.997778
                   desempleo  |  -1.403622   .0583537   -24.05   0.000    -1.517993   -1.289251
                 inactividad  |  -.0745186   .0511609    -1.46   0.145    -.1747921    .0257549
                              |
                    trimestre |
                       20103  |  -1.062116   .0410367   -25.88   0.000    -1.142546   -.9816853
                       20104  |  -.9858446   .0391022   -25.21   0.000    -1.062483   -.9092058
                       20111  |  -1.026833   .0407021   -25.23   0.000    -1.106608   -.9470585
                       20112  |  -1.005365   .0410619   -24.48   0.000    -1.085845   -.9248851
                       20113  |  -1.012619   .0407739   -24.83   0.000    -1.092534   -.9327033
                       20114  |  -1.137509   .0411576   -27.64   0.000    -1.218176   -1.056842
                       20121  |  -1.048486   .0415484   -25.24   0.000     -1.12992   -.9670527
                       20122  |  -1.004608   .0417201   -24.08   0.000    -1.086378   -.9228382
                       20123  |  -1.136711   .0416276   -27.31   0.000      -1.2183   -1.055123
                       20124  |  -1.167065   .0419751   -27.80   0.000    -1.249334   -1.084795
                              |
                           l2 |  -.9194336   .0347716   -26.44   0.000    -.9875847   -.8512825
                           l3 |  -1.269174   .0389872   -32.55   0.000    -1.345588   -1.192761
                           l4 |  -1.223991   .0360589   -33.94   0.000    -1.294665   -1.153317
                           l5 |   -1.48775   .0418342   -35.56   0.000    -1.569744   -1.405757
                           l6 |  -1.324202   .0460023   -28.79   0.000    -1.414365   -1.234039
                           l7 |  -1.887461   .0623366   -30.28   0.000    -2.009639   -1.765284
                           l8 |  -2.024483   .2646771    -7.65   0.000     -2.54324   -1.505725
                        mujer |   .6440309   .0210734    30.56   0.000     .6027278    .6853341
                      dumarea |   .1675381   .0242558     6.91   0.000     .1199975    .2150786
                              |
                       region |
                     central  |  -.0113691   .0255871    -0.44   0.657    -.0615189    .0387807
                   atlantico  |  -.0864323   .0353768    -2.44   0.015    -.1557695   -.0170951
                           4  |   -.069425   .0255769    -2.71   0.007    -.1195548   -.0192951
                              |
                     sectores |
                           2  |  -18.78935   .0445577  -421.69   0.000    -18.87668   -18.70201
                           3  |   3.518231   .0344689   102.07   0.000     3.450673    3.585789
                              |
                       s07p18 |
                 separado(a)  |   -.594809   .0302368   -19.67   0.000     -.654072    -.535546
               divorciado(a)  |  -.3615797   .1399995    -2.58   0.010    -.6359737   -.0871857
                    viudo(a)  |  -.1531652      .0871    -1.76   0.079     -.323878    .0175476
                  soltero(a)  |   .0519795   .0216474     2.40   0.016     .0095515    .0944075
      -----------------------------------------------------------------------------------------
      
      .
      and then I try the margins and this shows up

      Code:
      . margins, dydx(*) predict(outcome(1))
      
      Average marginal effects                        Number of obs     =    160,341
      Model VCE    : Robust
      
      Expression   : Pr(cond_empleo==formal_empleado), predict(outcome(1))
      dy/dx w.r.t. : 2.trans 3.trans 4.trans 5.trans 6.trans 20103.trimestre 20104.trimestre 20111.trimestre 20112.trimestre
                     20113.trimestre 20114.trimestre 20121.trimestre 20122.trimestre 20123.trimestre 20124.trimestre l2 l3 l4
                     l5 l6 l7 l8 mujer dumarea 2.region 3.region 4.region 2.sectores 3.sectores 4.s07p18 5.s07p18 6.s07p18
                     7.s07p18
      
      -----------------------------------------------------------------------------------------
                              |            Delta-method
                              |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
      ------------------------+----------------------------------------------------------------
                        trans |
        formal cuenta propia  |          .  (not estimable)
           informal empleado  |          .  (not estimable)
      informal cuenta propia  |          .  (not estimable)
                   desempleo  |          .  (not estimable)
                 inactividad  |          .  (not estimable)
                              |
                    trimestre |
                       20103  |          .  (not estimable)
                       20104  |          .  (not estimable)
                       20111  |          .  (not estimable)
                       20112  |          .  (not estimable)
                       20113  |          .  (not estimable)
                       20114  |          .  (not estimable)
                       20121  |          .  (not estimable)
                       20122  |          .  (not estimable)
                       20123  |          .  (not estimable)
                       20124  |          .  (not estimable)
                              |
                           l2 |          .  (not estimable)
                           l3 |          .  (not estimable)
                           l4 |          .  (not estimable)
                           l5 |          .  (not estimable)
                           l6 |          .  (not estimable)
                           l7 |          .  (not estimable)
                           l8 |          .  (not estimable)
                        mujer |          .  (not estimable)
                      dumarea |          .  (not estimable)
                              |
                       region |
                     central  |          .  (not estimable)
                   atlantico  |          .  (not estimable)
                           4  |          .  (not estimable)
                              |
                     sectores |
                           2  |          .  (not estimable)
                           3  |          .  (not estimable)
                              |
                       s07p18 |
                 separado(a)  |          .  (not estimable)
               divorciado(a)  |          .  (not estimable)
                    viudo(a)  |          .  (not estimable)
                  soltero(a)  |          .  (not estimable)
      -----------------------------------------------------------------------------------------
      Note: dy/dx for factor levels is the discrete change from the base level.
      I would appreciate any help.

      Comment


      • #4
        Non-estimable margins usually result from an "empty cell." That is, you have several factor variables in your model: sep07p18, sectores, region, and trimestre. Each of those has several possible values (5, 3, 2, and 11). So there are in principle 11*5*3*2 = 330 combinations of these. If not all 330 combinations actually appear in the estimation sample, then you can encounter this problem. To identify the missing combinations, try

        Code:
        contract s07p18 sectores region trimestre if e(sample), zero
        The combinations with zero count are your potential problems. Is it possible to fill those in with data? If not, you can try your -margins- command with the -asbalanced emptycells(reweight)- options. And if that doesn't work, you can do -margins- with the -noestimcheck- option. The last will always give you results. The problem with the first of these approaches is that the -asbalanced emptycells(reweight)- approach is not calculating actual average marginal effects from your data set: rather it is reweighting your data as if you had a completely balanced design on all of the factor variables and calculating the marginal effects on that. And the problem with the second approach is that the resulting calculations cold come out differently if you were to run the same model with a different parameterization (for example, if you used different base categories for your discrete variables).

        Added: A safer approach than the above is to give up the pretense of obtaining average marginal effects and instead settle on important and interesting values of the predictor variables and obtain marginal effects at those values (using the -at()-) option. As long as you don't specify combinations of values that are not in the data, you will get estimable marginal effects, and they will not be sensitive to the parameterization of the model.
        Last edited by Clyde Schechter; 25 Apr 2016, 17:59.

        Comment

        Working...
        X