Announcement

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

  • "convergence not achieved" in multilevel logit model

    Hello, I have been working on running a random slope model, on longitudinal data (in long form) using the logit model. However, I have encountered an issue that I cannot resolve, so I wanted to reach out to you for guidance.

    Here is the description of the model:
    Focal variable (outcome): Work Assessment (binary, n=1 for 682 cases, 0 for 8,701 cases)
    Main predictor: Early Retirement Pressure (binary)
    Total number of observations in the dataset: 57,976
    Number of observations when running this model: 3,463 with 1,363 individuals

    My question is as follows: I attempted to implement the random slope model as you taught us last time.
    The random intercept code works well, but when I include the random slope for centered age, I encounter a "convergence" issue, and the maximum log-likelihood is reported as "not concave."

    (Random Intercept)
    melogit workassess i.female edu lg_hinc i.urban $health i.earlyret##c.c_age || pid:, cov(un)

    (Random Slope Model)
    melogit workassess i.female edu lg_hinc i.urban $health i.earlyret##c.c_age || pid: c_age, cov(un)

    Is there any way to modify the model settings in this case? And Here is my result.

    Iteration 296: log likelihood = -921.96692 (not concave)
    Iteration 297: log likelihood = -921.96692 (not concave)
    Iteration 298: log likelihood = -921.96692 (not concave)
    Iteration 299: log likelihood = -921.96692 (not concave)
    Iteration 300: log likelihood = -921.96692 (not concave)
    convergence not achieved

    Mixed-effects logistic regression Number of obs = 3,463
    Group variable: pid Number of groups = 1,363

    Obs per group:
    min = 1
    avg = 2.5
    max = 4

    Integration method: mvaghermite Integration pts. = 7

    Wald chi2(8) = 80.77
    Log likelihood = -921.96692 Prob > chi2 = 0.0000
    ----------------------------------------------------------------------------------
    workassess | Coefficient Std. err. z P>|z| [95% conf. interval]
    -----------------+----------------------------------------------------------------
    c_age | -.0023769 .017445 -0.14 0.892 -.0365685 .0318147
    1.female | .4622551 .1717717 2.69 0.007 .1255889 .7989214
    edu | -.2801203 .138019 -2.03 0.042 -.5506326 -.0096081
    lg_hinc | -.3565346 .1255152 -2.84 0.005 -.6025399 -.1105292
    1.urban | .2396985 .2315582 1.04 0.301 -.2141473 .6935443
    1.firselfhealth | .8681222 .1615322 5.37 0.000 .5515249 1.184719
    chronic | .195936 .0959162 2.04 0.041 .0079438 .3839283
    1.earlyret | .463443 .1886819 2.46 0.014 .0936333 .8332527
    _cons | -.7321033 1.005356 -0.73 0.466 -2.702565 1.238358
    -----------------+----------------------------------------------------------------
    pid |
    var(c_age)| .0051863 3.91e-07 .0051855 .005187
    var(_cons)| .9579369 .0000659 .9578077 .9580661
    -----------------+----------------------------------------------------------------
    pid |
    cov(c_age,_cons)| .070485 . . . . .
    ----------------------------------------------------------------------------------
    convergence not achieved
    r(430);



    Additionally, I have come across the use of the "gsem" command for multilevel models. Since "gsem" is a structural equation modeling command, would it be appropriate to use it as an alternative to the current code? Thank you for your assistance.

  • #2
    Originally posted by Gayoung Choi View Post
    Is there any way to modify the model settings in this case?
    A couple of things to try:

    1. In order to help with numerical stability, divide the centered age by 100 or even by 1000

    2. Simplify the model. You can start with changing the random effects covariance: cov(un)covariance(independent)

    And melogit sees 3463 out of 57 976 total observations, 1363 out of 682 + 8701 total cases. Maybe consider triage on predictors that have a lot of missing values.

    (Random Slope Model)
    melogit workassess i.female edu lg_hinc i.urban $health i.earlyret##c.c_age || pid: c_age, cov(un)
    The output that you show doesn't correspond to that model specification. The output has no interaction term in it. Not that age is very impressive in its association with the outcome variable.

    . . . as you taught us last time
    I took that as just an expression and not as an indication that this is homework.

    Comment


    • #3
      Originally posted by Gayoung Choi View Post
      Focal variable (outcome): Work Assessment (binary, n=1 for 682 cases, 0 for 8,701 cases)
      So the outcome doesn't change within individual? If you're just exploring the association between the outcome and the two predictors and their interaction, then, given the attrition from missing data, you might as well consider something along the following lines at least as a first-pass assessment.
      Code:
      generate double adc = age / 10 // uncentered age
      generate byte mco = 0
      foreach var of varlist workassess female edu lg_hinc urban irselfhealth chronic earlyret adc {
          quietly replace mco = mco + missing(`var')
      }
      gsort +pid +mco -adc
      by pid: generate byte use = _n == 1
      
      logit workassess i.earlyret##c.adc ///
          i.(female urban irselfhealth) c.(edu lg_hinc chronic) if use, nolog // -vce()- to taste
      quietly centile adc, centile(25 50 75) // you need only two, but the graph is cuter with three
      quietly margins earlyret, at(adc = (`r(c_1)' `r(c_2)' `r(c_3)')) predict(xb)
      marginsplot , ///
          title("") xtitle(Employee Age (Decades)) ///
          plotopts(lcolor(black) msymbol(O) mcolor(black) mfcolor(white)) ///
          level(50) ciopts(lcolor(black)) ///
          scheme(s2color) ylabel( , angle(horizontal) nogrid) legend(off)
      The code plots the predictions in the estimation metric, but you could opt to plot predicted proportions.

      Comment


      • #4
        Originally posted by Joseph Coveney View Post
        A couple of things to try:

        1. In order to help with numerical stability, divide the centered age by 100 or even by 1000

        2. Simplify the model. You can start with changing the random effects covariance: cov(un)covariance(independent)

        And melogit sees 3463 out of 57 976 total observations, 1363 out of 682 + 8701 total cases. Maybe consider triage on predictors that have a lot of missing values.

        The output that you show doesn't correspond to that model specification. The output has no interaction term in it. Not that age is very impressive in its association with the outcome variable.

        I took that as just an expression and not as an indication that this is homework.

        Thanks for your advice!!
        It really helpful for me!
        After I divide the centered age by 100, the model works!

        However, I have another problem.

        Based on the suggestions you all provided, I divided the values by 100 and reported the odds ratio.
        However, the numbers are being reported as excessively large. In this case, how should I proceed with the interpretation?

        the code is...
        Code:
        gen c_age100 = c_age/100
        melogit loneliness ($indi $health i.earlyret##ib1.sparti_tie)##c.c_age100 || pid: c_age100, cov(un) or
        Code:
        . melogit loneliness ($indi $health i.earlyret##ib1.sparti_tie)##c.c_age100 || pid: c_age100, cov(un) or
        
        Fitting fixed-effects model:
        
        Iteration 0:   log likelihood = -4219.2826  
        Iteration 1:   log likelihood = -4213.4815  
        Iteration 2:   log likelihood =  -4213.479  
        Iteration 3:   log likelihood =  -4213.479  
        
        Refining starting values:
        
        Grid node 0:   log likelihood = -4035.9539
        
        Fitting full model:
        
        Iteration 0:   log likelihood = -4035.9539  
        Iteration 1:   log likelihood = -4001.8698  
        Iteration 2:   log likelihood = -3998.4615  
        Iteration 3:   log likelihood = -3998.4105  
        Iteration 4:   log likelihood = -3998.4105  
        
        Mixed-effects logistic regression               Number of obs     =      7,798
        Group variable: pid                             Number of groups  =      1,815
        
                                                        Obs per group:
                                                                      min =          1
                                                                      avg =        4.3
                                                                      max =          8
        
        Integration method: mvaghermite                 Integration pts.  =          7
        
                                                        Wald chi2(22)     =     173.64
        Log likelihood = -3998.4105                     Prob > chi2       =     0.0000
        ------------------------------------------------------------------------------------------------
                            loneliness | Odds ratio   Std. err.      z    P>|z|     [95% conf. interval]
        -------------------------------+----------------------------------------------------------------
                              c_age100 |    1425814    8821996     2.29   0.022     7.715937    2.63e+11
                              1.female |   1.262223   .1254929     2.34   0.019     1.038742    1.533784
                                       |
                                   edu |
                                    2  |   .8987175    .097272    -0.99   0.324     .7269325    1.111098
                                    3  |   .8137522   .1246497    -1.35   0.178     .6027066    1.098698
                                       |
                               lg_hinc |   .7933476   .0402326    -4.56   0.000     .7182853     .876254
                               0.urban |   1.043351   .1315593     0.34   0.736     .8148913     1.33586
                       1.firselfhealth |   1.546035   .1178667     5.71   0.000     1.331452    1.795202
                             c_chronic |   1.151301   .0725386     2.24   0.025     1.017556    1.302625
                            1.earlyret |   1.277575   .2477085     1.26   0.206     .8736693    1.868209
                          0.sparti_tie |   1.174979   .1169125     1.62   0.105      .966794    1.427993
                                       |
                   earlyret#sparti_tie |
                                  1 0  |   1.609173   .3474376     2.20   0.028     1.053948    2.456893
                                       |
                 c.c_age100#c.c_age100 |   2.88e-06   .0000296    -1.24   0.215     4.98e-15    1659.099
                                       |
                     female#c.c_age100 |
                                    1  |   .1733652   .2587977    -1.17   0.240      .009296    3.233154
                                       |
                        edu#c.c_age100 |
                                    2  |   4.640404   7.620424     0.93   0.350     .1856613    115.9819
                                    3  |   416.0817   965.8807     2.60   0.009     4.397669    39367.21
                                       |
                  c.lg_hinc#c.c_age100 |    .159505   .1197276    -2.45   0.014     .0366307    .6945488
                                       |
                      urban#c.c_age100 |
                                    0  |   .0673028   .1292882    -1.40   0.160     .0015591    2.905258
                                       |
              firselfhealth#c.c_age100 |
                                    1  |   .2638762   .3436184    -1.02   0.306     .0205575    3.387124
                                       |
                c.c_chronic#c.c_age100 |   1.934838   1.919119     0.67   0.506     .2769227    13.51857
                                       |
                   earlyret#c.c_age100 |
                                    1  |   390.8541   1305.431     1.79   0.074     .5611099    272258.5
                                       |
                 sparti_tie#c.c_age100 |
                                    0  |     9.5464   15.49126     1.39   0.164     .3967957    229.6742
                                       |
        earlyret#sparti_tie#c.c_age100 |
                                  1 0  |   .0009308   .0035178    -1.85   0.065     5.65e-07    1.533925
                                       |
                                 _cons |   1.024956    .426968     0.06   0.953     .4530211    2.318953
        -------------------------------+----------------------------------------------------------------
        pid                            |
                          var(c_age100)|   103.4066   31.49621                      56.92253    187.8505
                             var(_cons)|   1.595473   .1645452                      1.303475    1.952882
        -------------------------------+----------------------------------------------------------------
        pid                            |
                    cov(c_age100,_cons)|   3.163299   1.668592     1.90   0.058    -.1070801    6.433679
        ------------------------------------------------------------------------------------------------
        Note: Estimates are transformed only in the first equation to odds ratios.
        Note: _cons estimates baseline odds (conditional on zero random effects).
        LR test vs. logistic model: chi2(3) = 430.14              Prob > chi2 = 0.0000
        
        Note: LR test is conservative and provided only for reference.

        **In my opinion, the reason for the odds ratio being extremely large is likely due to the division of age by 100. Is there a way to report the table in its original state, without dividing by 100?
        ***I'd like to justify dividing centered age by 100. Is there a statistical paper that discusses this?

        Comment

        Working...
        X