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).
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
Comment