Announcement

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

  • Lagged variables in a mediation model

    I have a mediation model in which I want X to occur before M which occurs before Y.
    When using the gsem command, how do I lag the variables correctly?
    I have now done it as follows, but I'm not sure I'm doing it correctly, both when it comes to my year variable lag and the X and Control variables lag in the second equation.

    gsem (L2.X i.L2.year L2.Controls -> L1.M, ) (L2.X L1.M i.L2.year L2.Controls -> Y, family(bernoulli) link(probit)), vce(robust) nocapslatent

    Also, I seem to lose one year of data too much. Instead of losing two years of observations I lose three. Could the year dummies have anything to do it? I get the following error for the year that 'goes missing':
    note: 2019.year omitted because of collinearity

    When I use a normal probit regresion with the lags as such: xtprobit Y L2.X L1.M i.L2.year, re vce(robust)

    The 2019.year is not omitted, so I don't know what could lead to the collinearity error?

    Help would be much appreciated!

  • #2
    I get the following error for the year that 'goes missing':
    note: 2019.year omitted because of collinearity

    When I use a normal probit regresion with the lags as such: xtprobit Y L2.X L1.M i.L2.year, re vce(robust)

    The 2019.year is not omitted, so I don't know what could lead to the collinearity error?
    So it looks like there is a colinearity involving the year variables and one or more of the "Control" variables, since that is what is really changing between the two models. If you have among the "Control" variables one which identifies a subset of the years, such as an indicator for years in which there was a recession, or contrasting years before vs after some event, then that kind of variable is necessarily colinear with i.year and either it or an additional year indicator will be omitted to break the colinearity.

    Comment


    • #3
      Thanks, I found what went wrong!
      And do I use the lags correctly in my model? So in the second equation I use L2. for X and my controls and L1. for the mediator.

      Comment


      • #4
        Yes, I believe your use of lags is correct for your purpose.

        Comment

        Working...
        X