Announcement

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

  • Multilevel mediation models

    Hello,

    I’m working on a multilevel structural equation model (SEM) to explore relationship between food access (independent variable) and academic outcomes in the US (dependent variable, continuous), mediated by two variables (both continuous mediators).

    I’ve based my approach on the eg provided in the documentation here: https://www.stata.com/manuals/semexample42g.pdf


    I’ve decomposed the total effect of access on performance (total, direct, indirect effects) and then calculated the % mediated as (indirect effect/total effect) * 100. I’m a bit unsure about whether the way I’ve calculated the % mediated is correct? First time running this type of model and couldn’t find any similar questions on the forum. I’ve included my code below. The access variable has three categories (1, 2, 3 - 1 is the reference group).

    Code:
    gsem (pv_std <- i.foodpov missed motivation M1[sc]) /// 
         (missed <- i.foodpov M2[sc]) /// 
         (motivation <- i.foodpov M3[sc]), /// 
         cov(M1[sc]*M2[sc]@0 M1[sc]*M3[sc]@0 M2[sc]*M3[sc]@0)
    
    
    
    *% mediated
    
    *Low category 
    
    nlcom ((_b[pv_std:missed] * _b[missed:2.foodpov]) / (_b[pv_std:2.foodpov] + (_b[pv_std:missed] * _b[missed:2.foodpov]) + (_b[pv_std:motivation] * _b[motivation:2.foodpov]))) * 100
    
    
    nlcom ((_b[pv_std:motivation] * _b[motivation:2.foodpov]) / (_b[pv_std:2.foodpov] + (_b[pv_std:missed] * _b[missed:2.foodpov]) + (_b[pv_std:motivation] * _b[motivation:2.foodpov]))) * 100
    
    
    nlcom (((_b[pv_std:missed] * _b[missed:2.foodpov]) + (_b[pv_std:motivation] * _b[motivation:2.foodpov])) / (_b[pv_std:2.foodpov] + (_b[pv_std:missed] * _b[missed:2.foodpov]) + (_b[pv_std:motivation] * _b[motivation:2.foodpov]))) * 100
    
    
    
    *high category 
    
    nlcom ((_b[pv_std:missed] * _b[missed:3.foodpov]) / (_b[pv_std:3.foodpov] + (_b[pv_std:missed] * _b[missed:3.foodpov]) + (_b[pv_std:motivation] * _b[motivation:3.foodpov]))) * 100
    
    
    nlcom ((_b[pv_std:motivation] * _b[motivation:3.foodpov]) / (_b[pv_std:3.foodpov] + (_b[pv_std:missed] * _b[missed:3.foodpov]) + (_b[pv_std:motivation] * _b[motivation:3.foodpov]))) * 100
    
    
    nlcom (((_b[pv_std:missed] * _b[missed:3.foodpov]) + (_b[pv_std:motivation] * _b[motivation:3.foodpov])) / (_b[pv_std:3.foodpov] + (_b[pv_std:missed] * _b[missed:3.foodpov]) + (_b[pv_std:motivation] * _b[motivation:3.foodpov]))) * 100

  • #2
    Indirect, direct, and total effects are calculated similarly when you have a multicategory predictor, however the interpretation is different. Because you calculate these effects for each of the non-holdout categories of the multicategory independent variable, they are interpreted as relative effects given that they are relative to the whatever the holdout category is for the variable. See Hayes and Preacher (2014) for a full discussion of this situation. Please note, however, their words of caution on page 461:
    Expressing a relative direct or indirect effect as a ratio relative to its corresponding relative total effect, while tempting, has documented problems as an effect size measure and so we discourage doing so.
    With regards to multiple mediators and a multicategory independent variable, see pages 10 and 11 of the supplementary materials of the linked paper (at the end of the main paper). Basically, everything is calculated the same as in the single mediator case with all direct and indirect effects relative. To get the relative total effect of a given level of the IV, you add it's relative direct effect + the sum of its relative indirect effects.

    The code below shows the appropriate calculations for a single level example.
    Code:
    ******************************
    ** Mediation w/ multicategory
    **  predictor and two mediators
    ******************************
    use https://stats.idre.ucla.edu/stat/data/hsbdemo, clear
    gsem (math <- i.ses) /// mv1 
         (write <- i.ses) /// mv2
         (science <- math write i.ses), cov(e.math*e.write) // dv
    eststo no_int
    gsem, coeflegend
    
    ** total relative effect of 2.ses vs. 1.ses 
    nlcom _b[science:2.ses] + (_b[science:math] * _b[math:2.ses]) ///
        + (_b[science:write] * _b[write:2.ses])
    ** relative indirect effect of 2.ses vs. 1.ses
    *math
    nlcom (_b[science:math] * _b[math:2.ses])
    * write 
    nlcom (_b[science:write] * _b[math:2.ses])
    
    ** total relative effect of 3.ses vs. 1.ses 
    nlcom _b[science:3.ses] + (_b[science:math] * _b[math:3.ses]) ///
        + (_b[science:write] * _b[write:3.ses])
    **relative indirect effect of 3.ses vs. 1.ses
    *math
    nlcom (_b[science:math] * _b[math:3.ses])
    *write
    nlcom (_b[science:write] * _b[math:3.ses])

    Comment

    Working...
    X