Announcement

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

  • Multilevel - Mixed-Effects Model Specification

    Dear Collegues

    I would like to ask your help to correctly run the code for a multilevel approach.

    I´m working with data containing information for 1546 individuals, grouped into 14 groups (ranging from 11 to 24). The groups are defined by the variable "match" which in fact is the group variable that matches macroeconomic data (country level).


    In the first Level I want to estimate the following equation:

    Y = b0 + b1*X1 + b2*X2 + b3*X3 + error1


    IN the second level we assume that coefficients are influenced by country level variables, as follows

    b0 = a00 + a01*Z1 + a02*Z2 + a03*Z3 + a04*Z4+ error2

    b1 = a10 + error3

    b2 = a20 + a21*Z1 + a22*Z2+ a23 *Z3+ a24*Z4+ error3

    b3 = a30 + error4

    As you can see, it includes error terms and a change that can be performed (I believe) several options, the parameters that interest me are: a00; a01; a02; a03; a04; a10; a20 + a21; a22; a23; a24 and a30.

    Could you help me to design the "mixed" function in such terms?

    Thank you in advance

    Fábio

  • #2
    You have written your model in the form used by, among others, Raudenbush and Bryk. I always find it confusing because there are so many subscripts flying around. In addition, it puts the levels at which variables are defined into high relief, which is completely irrelevant in Stata multilevel modeling syntax.

    I also believe you have an error in your model because you use the same error3 in two different equations. This is possible, but highly unusual and I have never seen a real world situation where you would constrain the model in that way. I will renumber the errors below to eliminate this constraint.

    To translate this into something you can write in Stata syntax you have to substitute the right hand sides of the country level equations into the first level equation, and then combine terms. So you get

    Code:
    Y = a00 + a01*Z1 + a02*Z2 + a03*Z3 + a04*Z4+ error2  
    + (a10 + error3)*X1 + (a20 + a21*Z1 + a22*Z2+ a23 *Z3+ a24*Z4+ error4)*X2 + (a30 + error5)*x3 + error1

    which transforms to

    Code:
    Y = a00 + a01*Z1 + a02*Z2 + a03*Z3 + a04*Z4
         + a10*X1
         + a20*X2 + a21*Z1*X2 + a22*Z2*X2+ a23 *Z3*X2+ a24*Z4*x2 
         + a30*X3
         + error1 (observation level)
         + error2 (country level)
         + error3 (country level) * X1
         + error4 (country level) * X2
         + error5 (country level) * X3
    Code:
    
    


    Written this way, it is closer to Stata syntax, and we can now try to represent it that way. I will assume that all of these variables are continuous. If any are categorical, then we get into additional complications and have to drag out the old -xi:- command prefix to deal with that.

    Code:
    mixed Y X1 c.(Z1 Z2 Z3 Z4)##c.X2 X3 || country: X1 X2 X3
    Also consider whether any of the various options offered by -mixed- is useful or needed for your particular situation.
    Last edited by Clyde Schechter; 17 Feb 2020, 09:54.

    Comment


    • #3
      Dear Clyde Schechter, thank you very much for your help. It really makes sense and now the model goes well as you coded.

      Thank you again,

      Best Regards

      Comment

      Working...
      X