Announcement

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

  • Multilevel SEM with mediation at level 2 (using gsem)

    Dear all,

    I am attempting to run a multilevel mediation model with the ‘gsem’ command on Stata 14.0 (Windows 10).

    I am using a two-level data where individuals (protesters) are nested into demonstrations. I am trying to assess if individual (e.g. previous violent political behavior) and contextual (e.g. demonstration’s size) predictors influence demonstrations’ atmosphere (±tense according to the demonstrators’ perception of their interaction with the police). This is my X -> Y path (Xs: continuous and categorical, Y: binary, Multilevel variable: demonstrations IDs.

    The crucial hypothesis of the study is that the Xs at the second level influence the police presence (M) and then tense the demonstrations (Y). This is my X -> M -> Y path where M is a binary variable at level 2. However, the Xs are at level 1 and 2 while Y is at level1.

    The schema attached summarizes the data structure and the paths.

    In a basic rationale, I thought that it was not necessary to specify a multilevel for the relationship between X and M because … there is only one level (thus I acted as if it was a simple one level logit regression). But I specified a latent variable on the others relationships (random intercept) explaining the atmosphere (Y). I am not sure that the following command is the right way to test my model.

    Code:
    gsem (Y <- 0.X1 2.X1 i.X2 i.X3 i.X4 c.X5 i.X6 c.X7 c.X8 c.X9 i.X10 M1[M1] ///
    , family(binomial) link(logit)) ///
    (Y <- i.M M1[M1], family(binomial) link(logit)) ///
    (M <- 0.X1 2.X1 i.X2 i.X3 i.X4 c.X5 ///
    , family(binomial) link(logit)) ///
    , nocapslatent latent(M1) allbaselevels covstruct(_lexogenous, diagonal)
    First: Is it the right way? Is there something missing or wrong? Should I specify other things?

    Second: How to compute indirect effects? Is the following command correct? (It is based on nonlinear combination of estimators)

    Code:
    nlcom _b[Y:1.M]*_b[M:2.X1] , post
    nlcom _b[Y:1.M]*_b[M:0.X1] , post
    nlcom _b[Y:1.M]*_b[M:1.X2] , post
    Third: ‘Y’ is zero-inflated (‘0’ n=9668 ; ‘1’ n=582 - at level1). Should I specify another family and link (e.g. negative binomial or poisson) ?

    I have already check this post but unfortunately there is no response : http://www.statalist.org/forums/foru...mes-at-level-2

    Thank you.
    Adrien.

    Click image for larger version

Name:	data structure.png
Views:	1
Size:	59.5 KB
ID:	1367712

  • #2
    The mediation process is only at the second level variables so your code seems to do what you are looking for. I can't say much more about the distribution and the appropriate family and link types. The [M1] should be the demonstration_ID (it's a bit confusing to use the same name for the latent variable and the id variable). You can simplify the syntax by:
    Code:
    Y <- 0.X1 2.X1 i.X2 i.X3 i.X4 c.X5 i.X6 c.X7 c.X8 c.X9 i.X10 i.M M1[M1] ///
    , family(binomial) link(logit)) ///
    (M <- 0.X1 2.X1 i.X2 i.X3 i.X4 c.X5 ///
    , family(binomial) link(logit)) ///
    , nocapslatent latent(M1) allbaselevels covstruct(_lexogenous, diagonal)

    Comment


    • #3
      Thank you very much for responding to my main question.

      You right, it is a bit confusing to use the same name for the mediator and the latent variable.
      I hope the schema help.

      If someone has an idea for the 2nd and 3rd question, I still need response.

      Thanks.

      Comment

      Working...
      X