Hi,

I'm having some convergence troubles with xtmlogit (Stata 17). In trying to isolate exactly what aspects of my data are causing the convergence problems, I came across the following curious result.

I have a regression (described in more detail below) where convergence is not achieved. But, if I recode the dependent variable, by flipping which outcome I label as "0" and which I label as "1", then the regression converges. This seems remarkable to me, as the two regressions are essentially the same! Can someone explain to me what is going on here? Is this a bug?

I run the regression:
Code:
xtset subj_id
xtmlogit logit_var ib4.treatment_pair round if round >= 17 & link_changed == 0, covariance(unstructured)
and get the output:

Code:
Iteration 300: log likelihood = -426.40849  (not concave)
convergence not achieved

Random-effects multinomial logistic regression       Number of obs    =  1,057
Group variable: subj_id                              Number of groups =    144

Random effects u_i ~ Gaussian                        Obs per group:
                                                                  min =      2
                                                                  avg =    7.3
                                                                  max =     14

Integration method: mvaghermite                      Integration pts. =      7

                                                     Wald chi2(13)    = 828.70
Log likelihood = -426.40849                          Prob > chi2      = 0.0000

--------------------------------------------------------------------------------
     logit_var | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
0              |  (base outcome)
---------------+----------------------------------------------------------------
1              |
treatment_pair |
            1  |    4.58505   .6412856     7.15   0.000     3.328153    5.841947
            2  |   5.909073   1.016015     5.82   0.000     3.917719    7.900427
            3  |   4.878214   1.256084     3.88   0.000     2.416335    7.340093
            5  |  -.3215998   .8442502    -0.38   0.703      -1.9763      1.3331
            6  |  -241.1137          .        .       .            .           .
            7  |   .6811586   .8322975     0.82   0.413    -.9501144    2.312432
            8  |  -4.345004   1.127134    -3.85   0.000    -6.554146   -2.135861
            9  |   .2189924   1.167607     0.19   0.851    -2.069476    2.507461
           10  |  -1.108863   1.253222    -0.88   0.376    -3.565133    1.347406
           11  |  -240.9129          .        .       .            .           .
           12  |   -3.05133   1.635172    -1.87   0.062    -6.256207    .1535481
               |
         round |  -.0256789   .0161091    -1.59   0.111    -.0572521    .0058943
         _cons |  -1.270844   .8370925    -1.52   0.129    -2.911515     .369827
---------------+----------------------------------------------------------------
2              |
treatment_pair |
            1  |   30.59764   1.450718    21.09   0.000     27.75428    33.44099
            2  |   32.43751   1.511915    21.45   0.000     29.47421    35.40081
            3  |   29.23225          .        .       .            .           .
            5  |  -212.6786          .        .       .            .           .
            6  |  -214.0909          .        .       .            .           .
            7  |  -212.1836          .        .       .            .           .
            8  |  -213.6546          .        .       .            .           .
            9  |   -212.361          .        .       .            .           .
           10  |  -213.0046          .        .       .            .           .
           11  |  -213.9432          .        .       .            .           .
           12  |  -213.0525          .        .       .            .           .
               |
         round |  -.0188885    .027518    -0.69   0.492    -.0728229    .0350459
         _cons |   -29.6336    1.59356   -18.60   0.000    -32.75692   -26.51028
---------------+----------------------------------------------------------------
        var(u1)|   8.485527   2.115422                      5.205665    13.83189
        var(u2)|   7.613658   3.133812                      3.398094    17.05891
---------------+----------------------------------------------------------------
     cov(u1,u2)|   3.780754    1.99461     1.90   0.058    -.1286094    7.690118
--------------------------------------------------------------------------------
convergence not achieved

Next, I can recode the dependent variable as follows:

Code:
gen logit_var_alt = logit_var
replace logit_var_alt = 1 if logit_var == 0
replace logit_var_alt = 0 if logit_var == 1
And then try the regression again:

Code:
xtmlogit logit_var_alt ib4.treatment_pair round if round >= 17 & link_changed == 0, covariance(unstructured)
But this time I get convergence:

Code:
Iteration 12:  log likelihood = -426.40849  

Random-effects multinomial logistic regression       Number of obs    =  1,057
Group variable: subj_id                              Number of groups =    144

Random effects u_i ~ Gaussian                        Obs per group:
                                                                  min =      2
                                                                  avg =    7.3
                                                                  max =     14

Integration method: mvaghermite                      Integration pts. =      7

                                                     Wald chi2(23)    = 131.59
Log likelihood = -426.40849                          Prob > chi2      = 0.0000

--------------------------------------------------------------------------------
 logit_var_alt | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
0              |
treatment_pair |
            1  |   4.585051   .6412858     7.15   0.000     3.328154    5.841948
            2  |    5.90909   1.016016     5.82   0.000     3.917735    7.900445
            3  |   4.878216   1.256084     3.88   0.000     2.416337    7.340096
            5  |   -.321584   .8442495    -0.38   0.703    -1.976283    1.333115
            6  |  -32.31822   496390.9    -0.00   1.000    -972940.5    972875.9
            7  |   .6811845   .8322974     0.82   0.413    -.9500883    2.312457
            8  |  -4.344991   1.127134    -3.85   0.000    -6.554133    -2.13585
            9  |   .2190115   1.167607     0.19   0.851    -2.069456    2.507479
           10  |  -1.108861   1.253222    -0.88   0.376     -3.56513    1.347408
           11  |  -32.18744   508699.5    -0.00   1.000      -997065    997000.6
           12  |  -3.051317   1.635172    -1.87   0.062    -6.256194    .1535607
               |
         round |  -.0256789   .0161091    -1.59   0.111    -.0572521    .0058943
         _cons |  -1.270844   .8370924    -1.52   0.129    -2.911515    .3698269
---------------+----------------------------------------------------------------
1              |  (base outcome)
---------------+----------------------------------------------------------------
2              |
treatment_pair |
            1  |   24.07116   4716.124     0.01   0.996    -9219.363    9267.505
            2  |   25.91103   4716.125     0.01   0.996    -9217.523    9269.345
            3  |   22.70577   4716.125     0.00   0.996    -9220.729     9266.14
            5  |  -10.66647   624273.3    -0.00   1.000     -1223564     1223543
            6  |  -11.58321   967995.4    -0.00   1.000     -1897248     1897225
            7  |  -10.29275   686931.6    -0.00   1.000     -1346372     1346351
            8  |  -11.33954   593606.4    -0.00   1.000     -1163458     1163436
            9  |  -10.51976    1281540    -0.00   1.000     -2511783     2511762
           10  |  -3665.568          .        .       .            .           .
           11  |  -11.48309   980922.5    -0.00   1.000     -1922584     1922561
           12  |  -11.00178    1101679    -0.00   1.000     -2159261     2159239
               |
         round |  -.0188885    .027518    -0.69   0.492    -.0728229    .0350459
         _cons |  -23.10713   4716.125    -0.00   0.996    -9266.541    9220.327
---------------+----------------------------------------------------------------
        var(u0)|   8.485526   2.115426                      5.205661     13.8319
        var(u2)|   7.613663   3.133809                      3.398101     17.0589
---------------+----------------------------------------------------------------
     cov(u0,u2)|   3.780776   1.994613     1.90   0.058    -.1285933    7.690145
--------------------------------------------------------------------------------
LR test vs. multinomial logit: chi2(2) = 262.17           Prob > chi2 = 0.0000

Note that my data is sparse, which is likely the root cause of my convergence problems. In particular, the outcome of "2" can only ever occur when treatment_pair < 4.