I have unbalanced panel data for a maximum of four waves per individual. Based on this data I estimate the following regression with individual fixed effects:
HTML Code:
xtreg y i.x1 x2 i.x3 x4, fe vce(cluster id)
Now, I would like to decompose the effect of x1 into a direct effect and an indirect effect via mediation analysis. The mediator that I have in mind is a continuous variable z, which has a positive effect on y, while x1 has a negative effect on y.
How can I estimate the direct and indirect effect while controlling for unobserved heterogeneity using individual fixed effects?
In the forum, xtdpdml by Richard Williams was sometimes suggested (e.g. here: https://www.statalist.org/forums/for...ng-sem-command ), but I do not know if it fits my problem and how I would apply the command, i.e. how to indicate that I have panel data, that I want fixed effects and that I want the standard errors clustered at the individual level etc.
Thanks a lot for your help,
Stephanie
(I work with Stata 15 on Windows.)
0 Response to Mediation analysis with panel data and individual fixed effects: direct and indirect effects
Post a Comment