Announcement

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

  • Path Analysis Using 2 Stage Instrumental Variables Regression

    Hello Stata Community, (I'm on Stata 17.0)


    I have a panel data set and I would like to run a path analysis comparing the direct effect of X1 on Y1 with the indirect effect of X1 on Y1 that operates through an intermediary variable, X4.

    My set up is as follows:

    Stage 1: reg X4 X1 X2 X3 X5 X6 X7 i.year i.industry, cluster(double_cluster)

    Obtain predicted X4, call it "X4Hat"

    Stage 2: reg Y1 X1 X2 X3 X4Hat X5 X6 X7 i.year i.industry, cluster(double_cluster)

    i.year and i.industry are year and industry dummies.

    I would then also like to test for the significance of the product of the coefficents on X1 from stage 1 and X4Hat from stage 2. (coeff(X1) x coeff(X4hat)

    I would also like to test the difference between (coeff(X1) x coeff(X4Hat)) for different quartiles of my sample sorted on X5, and also generate a t-stat for this difference. I have followed the following code:


    Code:
    reg X4 X1 X2 X3 X5 X6 X7 i.year i.industry
    
    predict X4Hat
    replace X4Hat =. if X4==. 
    
    est sto m1
    
    reg Y1 X1 X2 X3 X4Hat X5 X6 X7 i.year i.industry
    
    est sto m2
    
    suest m1 m2, cluster(double_cluster)
    
    nlcom [m1_mean]X1 * [m2_mean]X4Hat
    I include the line replace X4Hat =. if X4==. to correct for missing observations in my unbalanced panel as some predicted values are generated where no data for X4 is present but data is available for the rest of the variables in the regression.

    Is this the correct way? Also, any help on the last point regarding testing the difference in the coefficients across quartiles of X5 would be appreciated.



    Ammar.


Working...
X