Announcement

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

  • multilevel logit model with the command 'meqrlogit' using nested data(3level)

    I run a multilevel logit model with the command 'meqrlogit' and want to calculate margins afterwards.

    The model I run looks like this: My data has a no random effect at 2level(iid) , but I want try 3level variable.

    Can i try to use 3level variable result, although var(_cons) estimate is near zero (and [95% conf. interval] is 0, .)?

    Can someone advise me on what I need to do?
    meqrlogit depvar indvar controlvars || country: || indiviual:

    Many thanks in advance,



    ---result1( 2level variable included)----------------------------------------------------------------------------------------------------------------------------------------------


    1level var: var1~unitprod
    2lecel var: gender count countt1
    3level var: rezscore

    meqrlogit HL var1 var2 ........................zscore year unitprod gender count countt1 i.report || distric: ||iid:

    Refining starting values:

    Iteration 0: Log likelihood = -101127.52
    Iteration 1: Log likelihood = -99249.164
    Iteration 2: Log likelihood = -99159.736

    Performing gradient-based optimization:

    Iteration 0: Log likelihood = -99159.736
    Iteration 1: Log likelihood = -98834.682
    Iteration 2: Log likelihood = -98826.102
    Iteration 3: Log likelihood = -98824.633
    Iteration 4: Log likelihood = -98824.543
    Iteration 5: Log likelihood = -98824.543

    Mixed-effects logistic regression Number of obs = 566,266

    ----------------------------------------------------------------------------
    | No. of Observations per group Integration
    Group variable | groups Minimum Average Maximum points
    ----------------+-----------------------------------------------------------
    distric | 14 2,315 40,447.6 98,092 7
    iid | 487,645 1 1.2 4 7
    ----------------------------------------------------------------------------

    Wald chi2(15) = 29183.93
    Log likelihood = -98824.543 Prob > chi2 = 0.0000

    --------------------------------------------------------------------------------
    HL | Coefficient Std. err. z P>|z| [95% conf. interval]
    ---------------+----------------------------------------------------------------
    var1 | -.500249 .0296816 -16.85 0.000 -.5584239 -.4420742
    var2 | .5448803 .0381579 14.28 0.000 .4700921 .6196685
    var3 | -.0109847 .0020302 -5.41 0.000 -.0149637 -.0070056
    var4 | 7.524782 1.684792 4.47 0.000 4.222651 10.82691
    zscore | -.0616966 .0063023 -9.79 0.000 -.0740489 -.0493442
    year | .0008218 .0006155 1.34 0.182 -.0003846 .0020283
    unitprod | .5638977 .0785972 7.17 0.000 .4098501 .7179454
    gender | -.0372934 .0206259 -1.81 0.071 -.0777195 .0031327
    count | -.5014045 .011078 -45.26 0.000 -.523117 -.4796921
    countt1 | 3.770489 .0245449 153.62 0.000 3.722382 3.818596
    |
    report |
    2 | .0101818 .0246468 0.41 0.680 -.0381251 .0584886
    3 | -.1079834 .0245145 -4.40 0.000 -.1560309 -.0599359
    |
    _cons | -5.530518 .2398565 -23.06 0.000 -6.000629 -5.060408
    --------------------------------------------------------------------------------

    ------------------------------------------------------------------------------
    Random-effects parameters | Estimate Std. err. [95% conf. interval]
    -----------------------------+------------------------------------------------
    distric: Identity |
    var(_cons) | .5107357 .1943563 .2422582 1.076748
    -----------------------------+------------------------------------------------
    iid: Identity |
    var(_cons) | 1.68e-14 6.32e-09 0 .
    ------------------------------------------------------------------------------
    LR test vs. logistic model: chi2(2) = 3982.06 Prob > chi2 = 0.0000

    Note: LR test is conservative and provided only for reference.


    estat icc

    Residual intraclass correlation

    ------------------------------------------------------------------------------
    Level | ICC Std. err. [95% conf. interval]
    -----------------------------+------------------------------------------------
    distric | .1343828 .0442662 .0685871 .2465864
    iid|distric | .1343828 .0442662 .0685871 .2465864
    ------------------------------------------------------------------------------




    ---result2( 3level variable included)----------------------------------------------------------------------------------------------------------------------------------------------


    meqrlogit HL var1 var2 var3..... zscore year unitprod gender count countt1 i.report rezscore || distric: ||iid:

    Refining starting values:

    Iteration 0: Log likelihood = -101133.73
    Iteration 1: Log likelihood = -99255.01
    Iteration 2: Log likelihood = -99138.046

    Performing gradient-based optimization:

    Iteration 0: Log likelihood = -99138.046
    Iteration 1: Log likelihood = -99118.546
    Iteration 2: Log likelihood = -98858.221
    Iteration 3: Log likelihood = -98818.615
    Iteration 4: Log likelihood = -98818.095
    Iteration 5: Log likelihood = -98818.087
    Iteration 6: Log likelihood = -98818.087

    Mixed-effects logistic regression Number of obs = 566,266

    ----------------------------------------------------------------------------
    | No. of Observations per group Integration
    Group variable | groups Minimum Average Maximum points
    ----------------+-----------------------------------------------------------
    distric | 14 2,315 40,447.6 98,092 7
    iid | 487,645 1 1.2 4 7
    ----------------------------------------------------------------------------

    Wald chi2(16) = 29185.02
    Log likelihood = -98818.087 Prob > chi2 = 0.0000

    --------------------------------------------------------------------------------
    HL | Coefficient Std. err. z P>|z| [95% conf. interval]
    ---------------+----------------------------------------------------------------
    var1 | -.4979377 .0296799 -16.78 0.000 -.5561093 -.4397662
    var2 | .5439284 .0381508 14.26 0.000 .4691542 .6187026
    var3 | -.0114268 .0020332 -5.62 0.000 -.0154117 -.0074418
    var4 | 7.213518 1.687064 4.28 0.000 3.906935 10.5201
    zscore | -.066191 .0064236 -10.30 0.000 -.078781 -.053601
    year| .0008425 .0006156 1.37 0.171 -.0003641 .002049
    unitprod | .5702453 .0786189 7.25 0.000 .4161551 .7243355
    gender | -.0374704 .0206265 -1.82 0.069 -.0778976 .002956
    count | -.5025206 .0110858 -45.33 0.000 -.5242484 -.4807929
    countt1 | 3.769611 .0245471 153.57 0.000 3.7215 3.817722
    |
    report |
    2 | .0292483 .025277 1.16 0.247 -.0202937 .0787902
    3 | -.0869191 .0252618 -3.44 0.001 -.1364314 -.0374069
    |
    rezscore | .0339146 .0094317 3.60 0.000 .0154289 .0524004
    _cons | -5.535763 .2414672 -22.93 0.000 -6.00903 -5.062496
    --------------------------------------------------------------------------------

    ------------------------------------------------------------------------------
    Random-effects parameters | Estimate Std. err. [95% conf. interval]
    -----------------------------+------------------------------------------------
    distric: Identity |
    var(_cons) | .5216787 .1985247 .2474449 1.099835
    -----------------------------+------------------------------------------------
    iid: Identity |
    var(_cons) | 1.58e-20 6.13e-12 0 .
    ------------------------------------------------------------------------------
    LR test vs. logistic model: chi2(2) = 3984.54 Prob > chi2 = 0.0000

    Note: LR test is conservative and provided only for reference.

    . estat icc

    Residual intraclass correlation

    ------------------------------------------------------------------------------
    Level | ICC Std. err. [95% conf. interval]
    -----------------------------+------------------------------------------------
    distric | .136868 .0449563 .0699528 .2505489
    iid|distric | .136868 .0449563 .0699528 .2505489
    ------------------------------------------------------------------------------





    Last edited by Jay Jang; 08 Apr 2024, 20:51. Reason: #meqrlogit #melogit #multilevellogit

  • #2
    The addition of a single variable, rezscore, to the model has made trivial changes to the results. Your model's variance component at the iid: level is, for practical purposes zero. If you want to make the point that there is no residual variance at the iid: level, then go ahead and use these results. But unless that is a key aspect of your research, I would omit the iid: level from the model altogether--it is doing nothing except taking up space in the output and slowing down the estimation.

    I don't know what version of Stata you are using. At one time -melogit- and -meqrlogit- were two separate commands that estimated the same multilevel logistic regression model using different calculation algorithms. Sometimes one would converge where the other failed. But in the current version, 18, they are a single command, and the name -meqrlogit-, although it still works, is obsolete. I don't recall when the two commands were merged, probably around version 16, but I'm not sure of that.

    Comment


    • #3
      Clyde Schechter , thank you so much your advance.
      your advice means "Even if the variance iid: 2level became zero, it's no ploblem to use a three-level model according to the point of the study". That's what your advice means, right?

      I understood that the smaller residual variance (iid: level) became more good when 1 level and 2 level variables were added to the model, but it was difficult to understand that residual variance(iid: level) became zero. I wondered if it should not be used statistically.

      Unfortunately, I would like to include "rezscore" because I focused on 2 level. and I will try "melogit", again.



      Comment


      • #4
        advice^^;;

        Comment


        • #5
          your advice means "Even if the variance iid: 2level became zero, it's no ploblem to use a three-level model according to the point of the study". That's what your advice means, right?
          Correct.

          I understood that the smaller residual variance (iid: level) became more good when 1 level and 2 level variables were added to the model, but it was difficult to understand that residual variance(iid: level) became zero. I wondered if it should not be used statistically.
          I'm not sure what you mean by "more good" here. In any event, it is possible that there was no iid level variance in your outcome regardless of what variables are in the model. Or perhaps there was some, but the included iid-level variables explain it all, leaving nothing for the random intercept to capture. The presence of zero variance at a level does not invalidate the model. The problem it can cause is making convergence of the estimation difficult or impossible. If you ran into that problem, you would have no choice but to remove the iid: level from the model. But you did get convergence, and fairly quickly.

          So it's up to you whether you want to leave it in or not. Because the variance at that level is so extremely small as to have no practical impact on the model coefficients or estimates, my preference is to omit it, and simply explain that to my audience. But if you have an audience that will be skeptical and want to see that the id: level variance component is, for practical purposes, zero, it is fine to leave it in. Or, if you think the fact that there is no residual variation at the id: level is, itself, an interesting finding that you want to show, then that's fine, too.

          Comment

          Working...
          X