Announcement

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

  • Running thee-level Multilevel Model

    Hello, I am running three-level Multilevel Model as follow

    L1 : Dependant = intercept + eijk
    L2 : PI0 = BETA00k + BETA01k*(VAR1) + BETA02k*(VAR2) + rojk
    L3 : BETA00k = GAMMA000 + uook
    BETA01k = GAMMA001 + uo1k
    BETA02k = GAMMA002 + uo2k


    and the following is my code

    . xtmixed y x1 x2, || schid: x1 x2, covariance(unstructured) || clssid:, var iter(50)


    the code is right? cause level 3 random effect value is ridiculous like below, and there are no standard error.

    Please let me know how to solve the problem.



    Mixed-effects REML regression Number of obs = 10193

    ----------------------------------------------------------------------------------------------------------------------
    | No. of Observations per Group
    Group Variable | Groups Minimum Average Maximum
    ----------------+-----------------------------------------------------------------------------------------------------
    schid | 31 186 328.8 586
    clssid | 347 14 29.4 43
    ----------------------------------------------------------------------------------------------------------------------

    Wald chi2(2) = 199.28
    Log restricted-likelihood = -53970.631 Prob > chi2 = 0.0000

    -----------------------------------------------------------------------------------------------------------------------------------------
    y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+---------------------------------------------------------------------------------------------------------------------------
    x1 | 17.46353 8.210631 2.13 0.033 1.370986 33.55607
    x2 | 93.73141 9.326184 10.05 0.000 75.45242 112.0104
    _cons | -139.4698 23.09094 -6.04 0.000 -184.7272 -94.21242
    -----------------------------------------------------------------------------------------------------------------------------------------

    -----------------------------------------------------------------------------------------------------------------------------------------
    Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    schid: Unstructured |
    var(x1) | 5.872092 . . .
    var(x2) | 5.110645 . . .
    var(_cons) | 32.12552 . . .
    cov(x1,x2) | -.2876809 . . .
    cov(x1,_cons) | -4.372661 . . .
    cov(x2,_cons) | -4.248289 . . .
    -----------------------------+-----------------------------------------------------------------------------------------------------------
    clssid: Identity |
    var(_cons) | 320.8363 . . .
    -----------------------------+-----------------------------------------------------------------------------------------------------------
    var(Residual) | 2195.363 . . .
    -----------------------------------------------------------------------------------------------------------------------------------------
    LR test vs. linear regression: chi2(7) = 1051.61 Prob > chi2 = 0.0000

    Note: LR test is conservative and provided only for reference.
    Warning: convergence not achieved; estimates are based on iterated EM







  • #2
    Warning: convergence not achieved; estimates are based on iterated EM

    Stata is telling you here that these results are not valid. The estimation did not converge.

    The immediate problem is the -iter(50)- option in the command which forces Stata to stop after 50 iterations. Evidently 50 iterations did not get you to convergence in this particular data and this model. So eliminate that option and let Stata go as long as it needs.

    Comment


    • #3
      When I eliminate iter(50) option, it still not converge.
      Then my code . xtmixed y x1 x2, || schid: x1 x2, covariance(unstructured) || clssid:, var
      is right code for the model

      L1 : Dependant = intercept + eijk
      L2 : PI0 = BETA00k + BETA01k*(VAR1) + BETA02k*(VAR2) + rojk
      L3 : BETA00k = GAMMA000 + uook
      BETA01k = GAMMA001 + uo1k
      BETA02k = GAMMA002 + uo2k


      ????

      The three level model code is really confusing.

      Comment


      • #4
        The model you show:
        L1 : Dependant = intercept + eijk
        L2 : PI0 = BETA00k + BETA01k*(VAR1) + BETA02k*(VAR2) + rojk
        L3 : BETA00k = GAMMA000 + uook
        BETA01k = GAMMA001 + uo1k
        BETA02k = GAMMA002 + uo2k

        is not a proper multi-level model, so no code will be correct for it. The problem with it is that nothing from L1 appears in the L2 or L3 levels. I'm guessing that what you are trying to specify here is a model where observations are nested in clssid and clssid's are nested in schid's. And you have random slopes at the schid level for variables x1 and x2, along with random intercepts at both the schid and clssid levels. That would be a well formed model. Of course, if the data do not actually conform to that nesting structure, attempting to fit a model with that structure will necessarily end in tears. Actually, non-convergence is the best case for that scenario: worse would be to get plausible-looking but incorrect results. So do verify that the data really are nested in that way, or else modify your model to reflect the actual relationships among the levels.

        Assuming that the nesting is as you coded, the command appears to be properly written. It may be that the data fail to identify the model. Whether that is just unfortunate or whether it reflects a problem in your data is something you will need to explore. The usual troubleshooting scheme for these models is to strip the model down to the bare minimum and then build it back up one step at a time until you reach the point where it breaks.:

        First verify that you can run -regress y x1 x2- without problems.

        Also leave the -cov(unstructured)- for last.

        Then run your -mixed- model without random slopes and only two levels. (Try it once each with clssid only and with schid only.)

        Then try random intercepts at all three levels, but still without random slopes.

        Then add the random slopes back in one at a time.

        Then add the -var(unstsructured)-.

        You will then see where things go wrong and further exploration of your data may uncover the source of your problem.

        Comment


        • #5
          Then I revise the model as follows

          L1 : Dependant = intercept + PI1k(Z1)+PI2k(Z2)+eijk

          L2 : PI0k = BETA00k + rojk
          PI1jk =BETA10k + r1jk
          P21jk =BETA20k + r2jk



          L3 : BETA00k = GAMMA000 + uook
          BETA10k = GAMMA100 + u10k
          BETA20k = GAMMA200 + u20k



          for this model, the code . xtmixed y z1 z2 || schid: z1 z2, cov(un) || clssid: z1 z2, cov(un) variance is right?

          And for this model,

          L1 : Dependant = intercept + PI1k(Z1)+PI2k(Z2)+eijk

          L2 : PI0k = BETA00k + rojk
          PI1jk =BETA10k + r1jk
          P21jk =BETA20k



          L3 : BETA00k = GAMMA000 + uook
          BETA10k = GAMMA100 + u10k
          BETA20k = GAMMA200


          the code is . xtmixed y z2 || schid: z1, cov(un) || clssid: z1, cov(un) variance is right?

          I am not sure it is right or wrong.

          Comment


          • #6
            I think you're not stating the models correctly. To be honest, I think it's because this whole approach with subscripts flying everywhere is very confusing. It's difficult to follow. I've been doing multi-level modeling for over two decades now and I haven't used this notation in at least 15 years. I guess there are people who find it helpful, but I'm not one of them. In any case, it looks to me like you're leaving things out.

            Let's just talk about random slopes and random intercepts at different levels. That's something we mere mortals can understand:

            Code:
            xtmixed y z1 z2 || schid: z1 z2, cov(un) || clssid: z1 z2, cov(un) variance
            This is a model with clssid nested in schid, and with random slopes for both z1 and z2 at both of those levels (as well as random intercepts.

            Code:
            xtmixed y z2 || schid: z1, cov(un) || clssid: z1, cov(un) variance
            This is probably a mis-specified model. In this model the slope of z2 does not vary at the schid or clssid levels--which is fine. As for z1, you have specified random slopes at both the schid and clssid levels, but you have constrained the mean slope for z1 to be zero. I don't think you intend that constraint. And although your L1: L2: and L3: equations themselves appear to be mis-specified and I cannot make a coherent model out of them, nothing in them suggests to me that you intend to constrain the mean slope of Z1 to zero. So assuming you don't want that constraint, the corresponding syntax should be:

            Code:
            xtmixed y z1 z2 || schid: z1, cov(un) || clssid: z1, cov(un) variance
            

            That would give you a model where the slope of z1 is not constrained, and also varies at the clssid and schid levels, while the slope of z2 is fixed.


            Comment

            Working...
            X