Announcement

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

  • How to address two idenpendent random intercepts into melogit?

    I formulate a equation as y=a0+aX+vi+ut The latter two term are random intercepts.
    How to code it in stata? I have tried
    melogit y x ||s: ||t:
    But there are nested relationship between s and t and provide intercepts as ust rather than ut...
    Coul you please help me?

    Thanks!

  • #2
    Tong,

    When you say independent, you mean non-nested? If so, then look at the syntax for fitting a cross-classified model. In your case, it would be something like this:
    Code:
    melogit y x || _all: R.s || t:
    Note that you will want to model the factor with the smallest number of units in the R. classification. Example 5 in the melogit section of Stata 15's me handbook has information on these models.

    Comment


    • #3
      Originally posted by Erik Ruzek View Post
      Tong,

      When you say independent, you mean non-nested? If so, then look at the syntax for fitting a cross-classified model. In your case, it would be something like this:
      Code:
      melogit y x || _all: R.s || t:
      Note that you will want to model the factor with the smallest number of units in the R. classification. Example 5 in the melogit section of Stata 15's me handbook has information on these models.
      Erik,

      Thanks! If I have more than random intercepts, then I can write like
      melogit y x || _all: R.s || _all:R.t: || _all: R.w ?
      Last edited by Tong Liu; 27 Sep 2019, 11:51.

      Comment


      • #4
        What do you mean more than random intercepts? Are you talking about allowing the effects of predictors on the outcome to vary across groups? If so, that syntax is different.

        Comment


        • #5
          I Think I mean only random-intercepts..
          Thanks!

          Comment


          • #6
            Yes, you can include such intercepts, but I would advise against always using the R. notation with your random intercepts, particularly if the data is partially nested. It may make the model computationally intractable. Each time you use R. with an intercept, each of the levels of the random factor is included as a separate parameter in the vector of random effects. With many random intercepts this becomes a huge design matrix. See the Marchenko article in Stata Journal in 2006 as well as Chapter 9 of Rabe-Hesketh & Skrondal's Longitudinal Modeling in Stata book for help with how to specify such models. If you do not have a partially nested model, then you may need to move to Bayesian estimation.

            Comment


            • #7
              Thank you Erik!

              Comment

              Working...
              X