Announcement

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

  • Random Slope for Interaction Term with meologit

    I am running a multilevel mixed model (meologit) for an ordered categorical variable (placement = low, med, high). I have interaction terms in the fixed part of the model and want to see if these vary across the level 2 units (schools) in the model. Running random slopes is computationally difficult and time consuming, so I created dummies for the main effect random slopes with the following code:

    Code:
    meologit placement ib(8).race i.test_result_lag ib(8).race i.frl i.gen pctblhis frl0 enroll0 ib(4).urbanicity i.year, ||school_id: rural, covariance (unstructured) or
    where rural is one category of the 4 category urbanicity variable (rural, urban, suburban, town). This ran fine (and much faster!). I am really on running this to get a rough idea of what the random slopes would look like, and am really only interested in the variation across the level 2 units for selected groups only. So I feek that the single dummy makes sense in this context. But I interested in seeing if the slopes vary for one part of the rural group (as specified by the 3 category test_result_lag variable).

    So I guess I have two questions:

    1) Am I specifying the the random slope for rural properly? Again, the alternative - putting ib(4).urbanicity after school_id takes forever to run.
    2) How can I create an interaction term for a random slope? The interaction term in the fixed part of the model is:

    Code:
    meologit placement ib(8).race i.test_result_lag##ib(4).urbanicity i.frl i.gen pctblhis frl0 enroll0 i.year, ||school_id:, or
    I hope I have expressed my problem clearly. I would appreciate any suggestions.

  • #2
    I remember the advice that the random slope part should always be included in the fixed part. In your example, rural (and I assume that is a binary variable, coded from the var urbanicity, indicating rural vs NOT rural), does not show up in the fixed part. Just as a check, I would believe your model results more if
    Code:
    meologit placement ib(8).race i.test_result_lag ib(8).race i.frl i.gen pctblhis frl0 enroll0 rural i.year, ||school_id: rural, covariance (unstructured) or
    Also produces sensible results. However, I am interested if there are different opinions about this.

    Regarding the second question, you can just use factor notation as well in the random part:
    Code:
    meologit placement ib(8).race i.test_result_lag##ib(4).urbanicity i.frl i.gen pctblhis frl0 enroll0 i.year, ||school_id: i.test_result_lag##ib(4).urbanicity, or
    To speed things up, you can also try to set intpoints() to a lower value for testing purposes.
    Best wishes

    Stata 18.0 MP | ORCID | Google Scholar

    Comment


    • #3
      Thank you for your quick response. That makes sense. I did try inpnts() but with a version of the code that included the factor notation (which takes forever). I will try this!

      Comment

      Working...
      X