Announcement

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

  • Mediation analysis with panel data and individual fixed effects: direct and indirect effects

    Dear all,

    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)
    where y is a 5-category variable and x1 is also a 5-category variable.

    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.)
    Last edited by Stephanie Retz; 09 Sep 2019, 02:36.

  • #2
    You may want to check a paper by Myles Shaver on mediation. Normally, we assume the errors on the intermediate variable are uncorrelated with the final outcome, but this is a questionable assumption. I could be wrong, but when your mediated variable is i.x1, I would think you really have 4 mediating variables (each of the dummies). This can probably also be done with one of the user-written mediation procedures or cmp or GSEM. The point of xtdpdml is that it would give you the Stata code for the GSEM representation of a similar model with fixed effects. Specifying a panel GSEM is not trivial and the xtdpdml would help you see how to do it.

    If you're sure you want fixed effects, you probably could use one of the user-written mediation procedures and just include panel dummies.

    Comment


    • #3
      Dear Phil,
      Thank you very much for your reply.

      Yes, I am sure that I want fixed effects to account for unobserved heterogeneity.

      May I ask what you mean by "use one of the user-written mediation procedures and just include panel dummies"? In particular
      • Which user-written mediation procedures are you referring to?
      • How would I have to write down the actual command (e.g. with xtdpdml)?
      • What do you mean by panel dummies? Do you mean a dummy for each individual and each point in time? This would soon become very incomprehensible, as I have almost one million observations.
      Thanks so much for your help!

      Best,
      Stephanie

      Comment


      • #4
        I have now also asked this question here: https://www.statalist.org/forums/for...ng-sem-command

        Comment


        • #5
          Hi Stephanie,

          As followed both posts but I think replies are not conclusive. Once I use post estimation command "estat teffects" after running a regression with xtdpdml command it brings too many coefficients with all lags of dependent and independent variable.

          How did you solve your problem in the end?

          Best,
          John

          Comment

          Working...
          X