Announcement

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

  • Comparing mediation effects across models in SEM?

    I'm wondering how to use SEM to compare mediation effects across models. Specifically, I want to do a "moderated mediation" approach, where the size of the indirect effect depends on the moderator. The way I currently do this is with seemingly unrelated estimation (suest), but I want to know how to do it with SEM.

    Code:
    eststo m1: reg y x          if moderator==1
    eststo m2: reg y x mediator if moderator==1 
    
    eststo m3: reg y x          if moderator==2
    eststo m4: reg y x mediator if moderator==2
    
    suest m1 m2 m3 m4 
    test [m1]x - [m2]x = [m3]x - [m4]x // does the *change* in x's effect size differ significantly depending on the moderator? 
    With SEM, I would normally do something like this—but from here, I don't know how to compare indirect effects.

    Code:
    sem (x m -> y) (x -> m) if moderator==1
    nlcom _b[y:m]*_b[m:x]
    sem (x m -> y) (x -> m) if moderator==2
    nlcom _b[y:m]*_b[m:x]
    I'm thinking I need to do something like this, but this produces "no observations."
    Code:
    gen y1 = y if moderator==1
    gen y2 = y if moderator==2
    
    sem (x m -> y1) (x -> m) (x m -> y2) (x -> m)
    nlcom _b[y1:m]*_b[m:x] - _b[y2:m]*_b[m:x]


  • #2
    For those who might be curious, I found an answer to this question: the group option.

    Let's say we want to look at the effect of years of education (x) on health (y), mediated by income and moderated by gender. In other words, does income explain the education–health relationship better for men, women, or nonbinary folks? (Or perhaps income explains the relationship equally?)

    We could type:

    Code:
    sem (educ -> inc) (educ inc -> health), group(gender) ginvariant(none)
    // ginvariant tells Stata what to set as equal across values of the moderator
    // e.g., scons = structural intercepts constrained to be equal
    Then we could test whether the indirect effect (the effect of education on health that passes through income) differs by gender. To find out what the pathnames are called, we could type

    Code:
    sem, coeflegend
    ... and this would give us the paths, which I've multiplied as necessary to produce indirect effects for each gender category:

    Code:
    nlcom (male: _b[health:1.gender#c.inc)*_b[inc:1.gender#c.educ) ///
    (female: _b[health:1.gender#c.inc)*_b[inc:2.gender#c.educ) ///
    (nonbinary: _b[health:1.gender#c.inc)*_b[inc:3.gender#c.educ), post
    test male = female = nonbinary
    You can find more info by typing
    Code:
    help sem group options
    or
    Code:
    help gsem group options

    Comment

    Working...
    X