Announcement

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

  • Error code 3200 "conformability error" when using margins after cmxtmixlogit - stata 16

    Dear Statalist,

    I'm running a labeled choice experiment using the new cmxtmixlogit command in Stata 16. It looks like a promising command, especially because of the possibility to use 'margins' as a postestimation command. However, i keep running into an error code 3200 when i use margins, even in its most basic form. I've been searching everywhere, but could not solve it unfortunately. All help would be very welcome.

    Example of data:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int ID_RESP byte(BLOCK CARD) float ORIGIN byte(CHOICE SHELFMID SHELFHIGH SIZEMID SIZEHIGH FERMMID FERMHIGH COLOR) double PRICE str10 CITY
    1 4 51 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
    1 4 52 1 0 0 0 0 0 1 0 1 600 "SaintLouis"
    1 4 53 1 0 0 1 0 1 1 0 1 400 "SaintLouis"
    1 4 54 1 0 1 0 0 1 0 1 1 600 "SaintLouis"
    1 4 55 1 0 0 0 1 0 0 0 0 400 "SaintLouis"
    1 4 56 1 1 1 0 0 0 1 0 0 400 "SaintLouis"
    1 4 51 2 1 1 0 0 0 1 0 0 400 "SaintLouis"
    1 4 52 2 1 1 0 0 1 0 0 0 400 "SaintLouis"
    1 4 53 2 1 0 0 0 0 0 1 0 600 "SaintLouis"
    1 4 54 2 1 0 0 1 0 0 0 0 400 "SaintLouis"
    1 4 55 2 1 1 0 0 1 0 1 1 600 "SaintLouis"
    1 4 56 2 0 0 0 1 0 0 0 1 600 "SaintLouis"
    2 2 39 1 0 1 0 1 0 1 0 1 400 "SaintLouis"
    2 2 40 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
    2 2 41 1 0 0 1 1 0 1 0 0 400 "SaintLouis"
    2 2 42 1 0 0 0 0 0 0 1 1 400 "SaintLouis"
    2 2 43 1 1 0 1 0 0 0 1 0 600 "SaintLouis"
    2 2 44 1 0 0 0 0 1 0 0 1 600 "SaintLouis"
    2 2 39 2 1 0 0 0 1 0 0 0 600 "SaintLouis"
    2 2 40 2 1 0 0 0 1 1 0 0 400 "SaintLouis"
    2 2 41 2 1 0 0 0 1 0 1 1 600 "SaintLouis"
    2 2 42 2 1 0 1 1 0 1 0 0 600 "SaintLouis"
    2 2 43 2 0 1 0 0 1 1 0 1 400 "SaintLouis"
    2 2 44 2 1 0 1 0 0 0 1 0 400 "SaintLouis"
    3 4 51 1 1 0 1 1 0 0 1 1 600 "SaintLouis"
    3 4 52 1 0 0 0 0 0 1 0 1 600 "SaintLouis"
    3 4 53 1 1 0 1 0 1 1 0 1 400 "SaintLouis"
    3 4 54 1 1 1 0 0 1 0 1 1 600 "SaintLouis"
    3 4 55 1 0 0 0 1 0 0 0 0 400 "SaintLouis"
    3 4 56 1 1 1 0 0 0 1 0 0 400 "SaintLouis"
    3 4 51 2 0 1 0 0 0 1 0 0 400 "SaintLouis"
    3 4 52 2 1 1 0 0 1 0 0 0 400 "SaintLouis"
    3 4 53 2 0 0 0 0 0 0 1 0 600 "SaintLouis"
    3 4 54 2 0 0 0 1 0 0 0 0 400 "SaintLouis"
    3 4 55 2 1 1 0 0 1 0 1 1 600 "SaintLouis"
    3 4 56 2 0 0 0 1 0 0 0 1 600 "SaintLouis"
    4 2 39 1 1 1 0 1 0 1 0 1 400 "SaintLouis"
    4 2 40 1 1 0 1 1 0 0 1 1 600 "SaintLouis"
    4 2 41 1 1 0 1 1 0 1 0 0 400 "SaintLouis"
    4 2 42 1 0 0 0 0 0 0 1 1 400 "SaintLouis"
    4 2 43 1 1 0 1 0 0 0 1 0 600 "SaintLouis"
    4 2 44 1 0 0 0 0 1 0 0 1 600 "SaintLouis"
    4 2 39 2 0 0 0 0 1 0 0 0 600 "SaintLouis"
    4 2 40 2 0 0 0 0 1 1 0 0 400 "SaintLouis"
    4 2 41 2 0 0 0 0 1 0 1 1 600 "SaintLouis"
    4 2 42 2 1 0 1 1 0 1 0 0 600 "SaintLouis"
    4 2 43 2 0 1 0 0 1 1 0 1 400 "SaintLouis"
    4 2 44 2 1 0 1 0 0 0 1 0 400 "SaintLouis"
    5 2 39 1 0 1 0 1 0 1 0 1 400 "SaintLouis"
    5 2 40 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
    5 2 41 1 0 0 1 1 0 1 0 0 400 "SaintLouis"
    5 2 42 1 1 0 0 0 0 0 1 1 400 "SaintLouis"
    5 2 43 1 1 0 1 0 0 0 1 0 600 "SaintLouis"
    5 2 44 1 0 0 0 0 1 0 0 1 600 "SaintLouis"
    5 2 39 2 1 0 0 0 1 0 0 0 600 "SaintLouis"
    5 2 40 2 1 0 0 0 1 1 0 0 400 "SaintLouis"
    5 2 41 2 1 0 0 0 1 0 1 1 600 "SaintLouis"
    5 2 42 2 0 0 1 1 0 1 0 0 600 "SaintLouis"
    5 2 43 2 0 1 0 0 1 1 0 1 400 "SaintLouis"
    5 2 44 2 1 0 1 0 0 0 1 0 400 "SaintLouis"
    6 4 51 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
    6 4 52 1 0 0 0 0 0 1 0 1 600 "SaintLouis"
    6 4 53 1 0 0 1 0 1 1 0 1 400 "SaintLouis"
    6 4 54 1 1 1 0 0 1 0 1 1 600 "SaintLouis"
    6 4 55 1 0 0 0 1 0 0 0 0 400 "SaintLouis"
    6 4 56 1 1 1 0 0 0 1 0 0 400 "SaintLouis"
    6 4 51 2 1 1 0 0 0 1 0 0 400 "SaintLouis"
    6 4 52 2 1 1 0 0 1 0 0 0 400 "SaintLouis"
    6 4 53 2 1 0 0 0 0 0 1 0 600 "SaintLouis"
    6 4 54 2 0 0 0 1 0 0 0 0 400 "SaintLouis"
    6 4 55 2 1 1 0 0 1 0 1 1 600 "SaintLouis"
    6 4 56 2 0 0 0 1 0 0 0 1 600 "SaintLouis"
    7 2 39 1 0 1 0 1 0 1 0 1 400 "SaintLouis"
    7 2 40 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
    7 2 41 1 0 0 1 1 0 1 0 0 400 "SaintLouis"
    7 2 42 1 1 0 0 0 0 0 1 1 400 "SaintLouis"
    7 2 43 1 1 0 1 0 0 0 1 0 600 "SaintLouis"
    7 2 44 1 1 0 0 0 1 0 0 1 600 "SaintLouis"
    7 2 39 2 1 0 0 0 1 0 0 0 600 "SaintLouis"
    7 2 40 2 1 0 0 0 1 1 0 0 400 "SaintLouis"
    7 2 41 2 1 0 0 0 1 0 1 1 600 "SaintLouis"
    7 2 42 2 0 0 1 1 0 1 0 0 600 "SaintLouis"
    7 2 43 2 0 1 0 0 1 1 0 1 400 "SaintLouis"
    7 2 44 2 0 0 1 0 0 0 1 0 400 "SaintLouis"
    8 3 45 1 1 1 0 0 0 0 0 1 400 "SaintLouis"
    8 3 46 1 1 1 0 0 1 0 0 1 400 "SaintLouis"
    8 3 47 1 1 0 0 1 0 1 0 1 400 "SaintLouis"
    8 3 48 1 1 0 0 1 0 1 0 0 600 "SaintLouis"
    8 3 49 1 1 0 1 0 0 1 0 0 400 "SaintLouis"
    8 3 50 1 1 0 1 0 1 0 1 0 400 "SaintLouis"
    8 3 45 2 0 0 1 0 1 1 0 0 600 "SaintLouis"
    8 3 46 2 0 0 0 1 0 1 0 0 600 "SaintLouis"
    8 3 47 2 0 0 1 0 1 0 1 0 600 "SaintLouis"
    8 3 48 2 0 0 1 0 0 0 1 1 400 "SaintLouis"
    8 3 49 2 0 1 0 1 0 0 1 0 600 "SaintLouis"
    8 3 50 2 0 1 0 0 0 1 0 1 600 "SaintLouis"
    9 1 33 1 0 0 0 1 0 0 1 1 400 "SaintLouis"
    9 1 34 1 1 0 1 0 0 1 0 0 600 "SaintLouis"
    9 1 35 1 0 0 0 1 0 0 0 1 400 "SaintLouis"
    9 1 36 1 0 1 0 1 0 0 0 1 500 "SaintLouis"
    end
    label values ORIGIN altlabel
    label def altlabel 1 "Import", modify
    label def altlabel 2 "Local", modify


    The code I used:

    Code:
    cmset ID_RESP CARD ORIGIN
    sort ID_RESP CARD ORIGIN
    
    cmxtmixlogit CHOICE SHELFMID SHELFHIGH SIZEMID SIZEHIGH FERMMID FERMHIGH COLOR PRICE, basealternative(Local) vce(cluster ID_RESP)
    margins

    Output:

    _mxl_predict(): 3200 conformability error
    <istmt>: - function returned error



    I thank you for your advice

  • #2
    Hi Hendrik,

    You have uncovered a bug in predict after cmxtmixlogit (and cmmixlogit) that is surfacing when all of the following conditions are true:

    o the alternatives variable has only two categories
    o the specified covariates are all alternative-specific (i.e., there are no case-specific variables in the model)
    o the model has an alternative-specific constant term

    We will provide a fix for this in a future update. In the meantime, I notice that your cmxtmixlogit specification has no random components and so you could fit the same model using the cmclogit command:

    Code:
    . cmclogit CHOICE SHELFMID SHELFHIGH SIZEMID SIZEHIGH FERMMID ///
    >          FERMHIGH PRICE COLOR, basealternative(Local) vce(cluster ID_RESP)
    note: 4 cases dropped because they have only one alternative
    note: variable SHELFMID has 21 cases that are not alternative-specific; there
          is no within-case variability
    note: variable SHELFHIGH has 17 cases that are not alternative-specific;
          there is no within-case variability
    note: variable SIZEMID has 16 cases that are not alternative-specific; there
          is no within-case variability
    note: variable SIZEHIGH has 12 cases that are not alternative-specific; there
          is no within-case variability
    note: variable FERMMID has 10 cases that are not alternative-specific; there
          is no within-case variability
    note: variable FERMHIGH has 12 cases that are not alternative-specific; there
          is no within-case variability
    note: variable COLOR has 1 case that is not alternative-specific; there is no
          within-case variability
    
    Iteration 0:   log pseudolikelihood = -28.832526  
    Iteration 1:   log pseudolikelihood = -27.286506  
    Iteration 2:   log pseudolikelihood = -26.404672  
    Iteration 3:   log pseudolikelihood = -26.398835  
    Iteration 4:   log pseudolikelihood = -26.398832  
    Iteration 5:   log pseudolikelihood = -26.398832  
    
    Conditional logit choice model                 Number of obs      =         96
    Case ID variable: _caseid                      Number of cases    =         48
    
    Alternatives variable: ORIGIN                  Alts per case: min =          2
                                                                  avg =        2.0
                                                                  max =          2
    
                                                      Wald chi2(7)    =          .
    Log pseudolikelihood = -26.398832                 Prob > chi2     =          .
    
                                    (Std. Err. adjusted for 8 clusters in ID_RESP)
    ------------------------------------------------------------------------------
                 |               Robust
          CHOICE |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    ORIGIN       |
        SHELFMID |   .7631662   .6049833     1.26   0.207    -.4225792    1.948912
       SHELFHIGH |   .1118694   .6029266     0.19   0.853    -1.069845    1.293584
         SIZEMID |  -.8339183   .4571831    -1.82   0.068    -1.729981    .0621441
        SIZEHIGH |   .2037432   .6892233     0.30   0.768     -1.14711    1.554596
         FERMMID |  -.3120842   .3163278    -0.99   0.324    -.9320753    .3079068
        FERMHIGH |   .3138121   .4969377     0.63   0.528     -.660168    1.287792
           PRICE |   .0004155   .0014589     0.28   0.776    -.0024439    .0032748
           COLOR |  -1.019933   .2440953    -4.18   0.000    -1.498351   -.5415146
    -------------+----------------------------------------------------------------
    Import       |
           _cons |   .5029555   .4819278     1.04   0.297    -.4416057    1.447517
    -------------+----------------------------------------------------------------
    Local        |  (base alternative)
    ------------------------------------------------------------------------------
    
    . margins
    
    Predictive margins                              Number of obs     =         96
    Model VCE    : Robust
    
    Expression   : Pr(ORIGIN|1 selected), predict()
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
        _outcome |
         Import  |   .4791667   .0948221     5.05   0.000     .2933188    .6650145
          Local  |   .5208333   .0948221     5.49   0.000     .3349855    .7066812
    ------------------------------------------------------------------------------

    Alternatively, if you wanted to add random coefficients to your cmxtmixlogit specification, you could still do that by adding another fake constant term as case-specific variable that will automatically be constrained to 0 in the model fit, and then you can use margins afterwards:
    Code:
    . gen cons2 = 1
    . cmxtmixlogit CHOICE SHELFMID SHELFHIGH SIZEMID SIZEHIGH FERMMID ///
    >              FERMHIGH COLOR PRICE, casevars(cons2) ///
    >              basealternative(Local) vce(cluster ID_RESP)
    Note: 4 cases (4 obs) dropped due to no positive outcome, multiple positive
          outcomes, or a single observation per case
    note: cons2 omitted because of collinearity
    
    Fitting fixed parameter model:
    
    Fitting full model:
    
    Iteration 0:   log pseudolikelihood = -26.398832  
    Iteration 1:   log pseudolikelihood = -26.398832  
    
    Mixed logit choice model                     Number of obs        =         96
                                                 Number of cases      =         48
    Panel variable: ID_RESP                      Number of panels     =          8
    
    Time variable: CARD                          Cases per panel: min =          6
                                                                  avg =        6.0
                                                                  max =          6
    
    Alternatives variable: ORIGIN                Alts per case:   min =          2
                                                                  avg =        2.0
                                                                  max =          2
    
    Integration points:              0                Wald chi2(7)    =    7202.62
    Log pseudolikelihood = -26.398832                 Prob > chi2     =     0.0000
    
                                    (Std. Err. adjusted for 8 clusters in ID_RESP)
    ------------------------------------------------------------------------------
                 |               Robust
          CHOICE |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    ORIGIN       |
        SHELFMID |   .7631662   .6049833     1.26   0.207    -.4225792    1.948912
       SHELFHIGH |   .1118694   .6029266     0.19   0.853    -1.069845    1.293584
         SIZEMID |  -.8339183   .4571831    -1.82   0.068    -1.729981    .0621441
        SIZEHIGH |   .2037432   .6892233     0.30   0.768     -1.14711    1.554596
         FERMMID |  -.3120842   .3163278    -0.99   0.324    -.9320753    .3079068
        FERMHIGH |   .3138121   .4969377     0.63   0.528     -.660168    1.287792
           COLOR |  -1.019933   .2440953    -4.18   0.000    -1.498351   -.5415146
           PRICE |   .0004155   .0014589     0.28   0.776    -.0024439    .0032748
    -------------+----------------------------------------------------------------
    Import       |
           cons2 |          0  (omitted)
           _cons |   .5029555   .4819278     1.04   0.297    -.4416057    1.447517
    -------------+----------------------------------------------------------------
    Local        |  (base alternative)
    ------------------------------------------------------------------------------
    
    . margins
    
    Predictive margins                              Number of obs     =         96
    Model VCE    : Robust
    
    Expression   : Pr(ORIGIN), predict()
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
        _outcome |
         Import  |   .4791667   .0948221     5.05   0.000     .2933188    .6650145
          Local  |   .5208333   .0948221     5.49   0.000     .3349855    .7066812
    ------------------------------------------------------------------------------
    I hope this helps, and we apologize for the inconvenience!

    Best,
    Joerg

    Comment


    • #3
      This is fixed as of the 16.1 update that went out to users today (February 18 2020). See #28 in
      Code:
      help whatsnew
      after updating.

      Best,
      Joerg

      Comment


      • #4
        Dear Joerg,

        even after updating to 16.1 I still run into the same conformability issues discussed above.

        The error occurs when I want to run the margins command after estimating a panel mixed logit model with the cmxtmixlogit command.

        Here is what I am doing:
        1. I run a series of mixlogit models with the cmxtmixlogit command.
        2. I store these estimations and save them to an external directory.
        3. In another do-file I use the saved estimations.
        4. I restore (one of) the models and run the margins, dydx() command to get the average marginal effects.

        Step 4 gives me an error message.

        Here is the code:
        Code:
        ** Estimate Models (in separate Do-File):
        global randvars  contr_veto contr_majo valad_fin valad_mkt valad_tec valad_str
        eststo M1: cmxtmixlogit choice share_inv, $sfx random($randvars, normal)
        
        ...
        
        ** Restore Estimation Results  
         estimates use "$dir_est\mlogit_est_base", number(7)
         estimates store M1
         estimates restore M1
         estimates esample:  
        
         ------------------------------------------------------------------------------------------------------
        Model M1
        ------------------------------------------------------------------------------------------------------
        
        Mixed logit choice model                     Number of obs        =      9,540
                                                     Number of cases      =      3,180
        Panel variable: id                           Number of panels     =        318
        
        Time variable: round                         Cases per panel: min =         10
                                                                      avg =       10.0
                                                                      max =         10
        
                                                     Alts per case:   min =          3
                                                                      avg =        3.0
                                                                      max =          3
        Integration sequence:      Hammersley
        Integration points:              1000             Wald chi2(7)    =     581.77
        Log simulated likelihood = -2187.4283             Prob > chi2     =     0.0000
        
        --------------------------------------------------------------------------------
                choice |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        ---------------+----------------------------------------------------------------
        inv_choiceset  |
             share_inv |   .1285042   .0063839    20.13   0.000      .115992    .1410164
            contr_veto |  -1.419583   .1107821   -12.81   0.000    -1.636712   -1.202454
            contr_majo |  -4.827915   .2965498   -16.28   0.000    -5.409142   -4.246688
             valad_fin |    .590742   .0864453     6.83   0.000     .4213122    .7601717
             valad_mkt |   1.404283   .1116378    12.58   0.000     1.185477    1.623089
             valad_tec |   .5142587   .0813041     6.33   0.000     .3549056    .6736118
             valad_str |   .4885298   .0832391     5.87   0.000     .3253842    .6516754
        ---------------+----------------------------------------------------------------
        /Normal        |
         sd(contr_veto)|   1.070534   .1434433                      .8232775    1.392051
         sd(contr_majo)|   2.785865   .2538625                      2.330205    3.330627
          sd(valad_fin)|   .8074495   .1186746                      .6053554    1.077012
          sd(valad_mkt)|   1.299533   .1263246                      1.074098    1.572283
          sd(valad_tec)|   .6601826   .1263541                      .4536808    .9606778
          sd(valad_str)|   .7523369   .1226959                      .5465036    1.035695
        --------------------------------------------------------------------------------
        
        
        
        ** Calculate Marginal Effects
         margins, dydx(share_inv)
                        select():  3200  conformability error
                  _mxl_predict():     -  function returned error
                         <istmt>:     -  function returned error
        Note that all variables in my example (except for share_inv) are binary variables, coded as 0/1.

        Help is much appreciated.

        Best
        Marius

        Comment


        • #5
          Hi Marius,

          I am unable to reproduce the problem on my end. To make sure we are on the same page, could you please run the following example, which uses the example dataset from earlier in this thread:

          Code:
          clear
          input int ID_RESP byte(BLOCK CARD) float ORIGIN byte(CHOICE SHELFMID SHELFHIGH SIZEMID SIZEHIGH FERMMID FERMHIGH COLOR) double PRICE str10 CITY
          1 4 51 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
          1 4 52 1 0 0 0 0 0 1 0 1 600 "SaintLouis"
          1 4 53 1 0 0 1 0 1 1 0 1 400 "SaintLouis"
          1 4 54 1 0 1 0 0 1 0 1 1 600 "SaintLouis"
          1 4 55 1 0 0 0 1 0 0 0 0 400 "SaintLouis"
          1 4 56 1 1 1 0 0 0 1 0 0 400 "SaintLouis"
          1 4 51 2 1 1 0 0 0 1 0 0 400 "SaintLouis"
          1 4 52 2 1 1 0 0 1 0 0 0 400 "SaintLouis"
          1 4 53 2 1 0 0 0 0 0 1 0 600 "SaintLouis"
          1 4 54 2 1 0 0 1 0 0 0 0 400 "SaintLouis"
          1 4 55 2 1 1 0 0 1 0 1 1 600 "SaintLouis"
          1 4 56 2 0 0 0 1 0 0 0 1 600 "SaintLouis"
          2 2 39 1 0 1 0 1 0 1 0 1 400 "SaintLouis"
          2 2 40 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
          2 2 41 1 0 0 1 1 0 1 0 0 400 "SaintLouis"
          2 2 42 1 0 0 0 0 0 0 1 1 400 "SaintLouis"
          2 2 43 1 1 0 1 0 0 0 1 0 600 "SaintLouis"
          2 2 44 1 0 0 0 0 1 0 0 1 600 "SaintLouis"
          2 2 39 2 1 0 0 0 1 0 0 0 600 "SaintLouis"
          2 2 40 2 1 0 0 0 1 1 0 0 400 "SaintLouis"
          2 2 41 2 1 0 0 0 1 0 1 1 600 "SaintLouis"
          2 2 42 2 1 0 1 1 0 1 0 0 600 "SaintLouis"
          2 2 43 2 0 1 0 0 1 1 0 1 400 "SaintLouis"
          2 2 44 2 1 0 1 0 0 0 1 0 400 "SaintLouis"
          3 4 51 1 1 0 1 1 0 0 1 1 600 "SaintLouis"
          3 4 52 1 0 0 0 0 0 1 0 1 600 "SaintLouis"
          3 4 53 1 1 0 1 0 1 1 0 1 400 "SaintLouis"
          3 4 54 1 1 1 0 0 1 0 1 1 600 "SaintLouis"
          3 4 55 1 0 0 0 1 0 0 0 0 400 "SaintLouis"
          3 4 56 1 1 1 0 0 0 1 0 0 400 "SaintLouis"
          3 4 51 2 0 1 0 0 0 1 0 0 400 "SaintLouis"
          3 4 52 2 1 1 0 0 1 0 0 0 400 "SaintLouis"
          3 4 53 2 0 0 0 0 0 0 1 0 600 "SaintLouis"
          3 4 54 2 0 0 0 1 0 0 0 0 400 "SaintLouis"
          3 4 55 2 1 1 0 0 1 0 1 1 600 "SaintLouis"
          3 4 56 2 0 0 0 1 0 0 0 1 600 "SaintLouis"
          4 2 39 1 1 1 0 1 0 1 0 1 400 "SaintLouis"
          4 2 40 1 1 0 1 1 0 0 1 1 600 "SaintLouis"
          4 2 41 1 1 0 1 1 0 1 0 0 400 "SaintLouis"
          4 2 42 1 0 0 0 0 0 0 1 1 400 "SaintLouis"
          4 2 43 1 1 0 1 0 0 0 1 0 600 "SaintLouis"
          4 2 44 1 0 0 0 0 1 0 0 1 600 "SaintLouis"
          4 2 39 2 0 0 0 0 1 0 0 0 600 "SaintLouis"
          4 2 40 2 0 0 0 0 1 1 0 0 400 "SaintLouis"
          4 2 41 2 0 0 0 0 1 0 1 1 600 "SaintLouis"
          4 2 42 2 1 0 1 1 0 1 0 0 600 "SaintLouis"
          4 2 43 2 0 1 0 0 1 1 0 1 400 "SaintLouis"
          4 2 44 2 1 0 1 0 0 0 1 0 400 "SaintLouis"
          5 2 39 1 0 1 0 1 0 1 0 1 400 "SaintLouis"
          5 2 40 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
          5 2 41 1 0 0 1 1 0 1 0 0 400 "SaintLouis"
          5 2 42 1 1 0 0 0 0 0 1 1 400 "SaintLouis"
          5 2 43 1 1 0 1 0 0 0 1 0 600 "SaintLouis"
          5 2 44 1 0 0 0 0 1 0 0 1 600 "SaintLouis"
          5 2 39 2 1 0 0 0 1 0 0 0 600 "SaintLouis"
          5 2 40 2 1 0 0 0 1 1 0 0 400 "SaintLouis"
          5 2 41 2 1 0 0 0 1 0 1 1 600 "SaintLouis"
          5 2 42 2 0 0 1 1 0 1 0 0 600 "SaintLouis"
          5 2 43 2 0 1 0 0 1 1 0 1 400 "SaintLouis"
          5 2 44 2 1 0 1 0 0 0 1 0 400 "SaintLouis"
          6 4 51 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
          6 4 52 1 0 0 0 0 0 1 0 1 600 "SaintLouis"
          6 4 53 1 0 0 1 0 1 1 0 1 400 "SaintLouis"
          6 4 54 1 1 1 0 0 1 0 1 1 600 "SaintLouis"
          6 4 55 1 0 0 0 1 0 0 0 0 400 "SaintLouis"
          6 4 56 1 1 1 0 0 0 1 0 0 400 "SaintLouis"
          6 4 51 2 1 1 0 0 0 1 0 0 400 "SaintLouis"
          6 4 52 2 1 1 0 0 1 0 0 0 400 "SaintLouis"
          6 4 53 2 1 0 0 0 0 0 1 0 600 "SaintLouis"
          6 4 54 2 0 0 0 1 0 0 0 0 400 "SaintLouis"
          6 4 55 2 1 1 0 0 1 0 1 1 600 "SaintLouis"
          6 4 56 2 0 0 0 1 0 0 0 1 600 "SaintLouis"
          7 2 39 1 0 1 0 1 0 1 0 1 400 "SaintLouis"
          7 2 40 1 0 0 1 1 0 0 1 1 600 "SaintLouis"
          7 2 41 1 0 0 1 1 0 1 0 0 400 "SaintLouis"
          7 2 42 1 1 0 0 0 0 0 1 1 400 "SaintLouis"
          7 2 43 1 1 0 1 0 0 0 1 0 600 "SaintLouis"
          7 2 44 1 1 0 0 0 1 0 0 1 600 "SaintLouis"
          7 2 39 2 1 0 0 0 1 0 0 0 600 "SaintLouis"
          7 2 40 2 1 0 0 0 1 1 0 0 400 "SaintLouis"
          7 2 41 2 1 0 0 0 1 0 1 1 600 "SaintLouis"
          7 2 42 2 0 0 1 1 0 1 0 0 600 "SaintLouis"
          7 2 43 2 0 1 0 0 1 1 0 1 400 "SaintLouis"
          7 2 44 2 0 0 1 0 0 0 1 0 400 "SaintLouis"
          8 3 45 1 1 1 0 0 0 0 0 1 400 "SaintLouis"
          8 3 46 1 1 1 0 0 1 0 0 1 400 "SaintLouis"
          8 3 47 1 1 0 0 1 0 1 0 1 400 "SaintLouis"
          8 3 48 1 1 0 0 1 0 1 0 0 600 "SaintLouis"
          8 3 49 1 1 0 1 0 0 1 0 0 400 "SaintLouis"
          8 3 50 1 1 0 1 0 1 0 1 0 400 "SaintLouis"
          8 3 45 2 0 0 1 0 1 1 0 0 600 "SaintLouis"
          8 3 46 2 0 0 0 1 0 1 0 0 600 "SaintLouis"
          8 3 47 2 0 0 1 0 1 0 1 0 600 "SaintLouis"
          8 3 48 2 0 0 1 0 0 0 1 1 400 "SaintLouis"
          8 3 49 2 0 1 0 1 0 0 1 0 600 "SaintLouis"
          8 3 50 2 0 1 0 0 0 1 0 1 600 "SaintLouis"
          9 1 33 1 0 0 0 1 0 0 1 1 400 "SaintLouis"
          9 1 34 1 1 0 1 0 0 1 0 0 600 "SaintLouis"
          9 1 35 1 0 0 0 1 0 0 0 1 400 "SaintLouis"
          9 1 36 1 0 1 0 1 0 0 0 1 500 "SaintLouis"
          end
          
          cmset ID_RESP CARD ORIGIN
          cmxtmixlogit CHOICE SHELFMID, random(SHELFHIGH SIZEMID, normal) nocons intp(100)
          margins, dydx(SHELFMID)
          The above margins specification yields the following output on my end:

          Code:
          . margins, dydx(SHELFMID)
          
          Average marginal effects                        Number of obs     =         96
          Model VCE    : OIM
          
          Expression   : Pr(ORIGIN), predict()
          dy/dx w.r.t. : SHELFMID
          
          ------------------------------------------------------------------------------
                       |            Delta-method
                       |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
          SHELFMID     |
              _outcome#|
                ORIGIN |
                  1 1  |   .0181325   .0872669     0.21   0.835    -.1529076    .1891725
                  1 2  |  -.0181325   .0872669    -0.21   0.835    -.1891725    .1529076
                  2 1  |  -.0181325   .0872669    -0.21   0.835    -.1891725    .1529076
                  2 2  |   .0181325   .0872669     0.21   0.835    -.1529076    .1891725
          ------------------------------------------------------------------------------
          What happens if you run the above? If you can run this example but still having trouble with your own dataset, please send us a reproducible example that includes a dataset and a do-file (which should include all the code needed to reproduce the problem) to: [email protected]

          Best,
          Joerg

          Comment


          • #6
            Dear Joerg,
            thanks! Your example has worked. I think I found the root of my error.

            The estimations I used had been calculated before the update. So they were -presumably- incompatible with the margins command.

            After having reeestimated the models they run smoothly.

            Best
            Marius

            Comment


            • #7
              Hi Marius,

              glad to hear that!

              Best,
              Joerg

              Comment

              Working...
              X