Announcement

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

  • Allowing Random Slopes to Change Across all Crossed Levels:

    Hi,

    Let's assume that we have a HLM model with crossed effects (2 levels). Here is the model: mixed Y X || _all:R.Level1 || _all:R.Level2 . How should we write the code when we are intending to allow the slope of X to change across both Level1 and Level2???

    I am tagging Clyde, since his comments have always been useful and timely.

  • #2
    This is somewhat complicated, but it is explained and illustrated at https://blog.stata.com/2010/12/22/in...ffects-models/. You have to read all the way to the end to get to random slopes in both crossed effects, but it's well written and worth the read from the beginning.

    Comment


    • #3
      I have read that already. Unfortunately, I do not get the last part that I think is related to my question here.

      Comment


      • #4
        So, this:

        Code:
        tab Level1, gen(id_lev1_)
        foreach v of varlist id_lev1_* {
            gen inter_`v' = X*`v'
        }
        
        mixed Y X || _all:R.Level1 || _all: inter_*, cov(identity) nocons ///
            || Level2: X

        Comment


        • #5
          Thanks a lot. It works.

          Comment

          Working...
          X