Hello all!
I'm working with a balanced panel data set where I examine 50 participants over 15 time periods. The participants are split up into a treatment group, and a control group, with treatment being administered at t=7. I'm running a simple diff-in-diff.
t is my variable indicating time period, hence is my timevar. ID indicates which participants are which, hence ID is my panelvar. Y is my dependent variable. TreatxPost is my variable of interest, demonstrating the effect of being in the treatment group, in the post period (post period being t>6).
Everything else are confounders that I control for. Finally, I control for 'time fixed effects', as certain years will feature shocks common to every participant.
My code is written beneath;
xtset t
tabulate t, gen(AnnualFE)
reghdfe Y TreatxPost confounder1 confounder2 confounder3 confounder4, absorb(ID t)
I would love to ask two questions (I am a complete rookie with Stata so please bear with me!).
1) I believe my second line of code controls for 'time fixed effects', but does my 3rd line (my regression), account for 'fixed effects'? Reading the Stata manual implies that reghdfe controls for fixed effects, but I just wanted to make sure!
2) This is the trickier question! I have a 5th confounder that I would like to include, but don't know how! For confounder5, I have a value for every participant at t=1. However, I have no values for t>1. To be clear - each participant has a different value of confounder5 at t=1.
I would like to control for confounder5. I've been given the following explanation but I don't really know what it means, nor how to write the code for it!
"For each participant, you could interact the t=1 value of confounder5 with 'time fixed effects'. This would reproduce variation in confounder5 over the 15 time periods, allowing you to control for confounder5".
Thank you for any help you can provide, and please forgive me if I'm not being clear! Furthermore, this is my first post, so I welcome any constructive criticism on how to pose questions in the future!
Best wishes,
Lewis
I'm working with a balanced panel data set where I examine 50 participants over 15 time periods. The participants are split up into a treatment group, and a control group, with treatment being administered at t=7. I'm running a simple diff-in-diff.
t is my variable indicating time period, hence is my timevar. ID indicates which participants are which, hence ID is my panelvar. Y is my dependent variable. TreatxPost is my variable of interest, demonstrating the effect of being in the treatment group, in the post period (post period being t>6).
Everything else are confounders that I control for. Finally, I control for 'time fixed effects', as certain years will feature shocks common to every participant.
My code is written beneath;
xtset t
tabulate t, gen(AnnualFE)
reghdfe Y TreatxPost confounder1 confounder2 confounder3 confounder4, absorb(ID t)
I would love to ask two questions (I am a complete rookie with Stata so please bear with me!).
1) I believe my second line of code controls for 'time fixed effects', but does my 3rd line (my regression), account for 'fixed effects'? Reading the Stata manual implies that reghdfe controls for fixed effects, but I just wanted to make sure!
2) This is the trickier question! I have a 5th confounder that I would like to include, but don't know how! For confounder5, I have a value for every participant at t=1. However, I have no values for t>1. To be clear - each participant has a different value of confounder5 at t=1.
I would like to control for confounder5. I've been given the following explanation but I don't really know what it means, nor how to write the code for it!
"For each participant, you could interact the t=1 value of confounder5 with 'time fixed effects'. This would reproduce variation in confounder5 over the 15 time periods, allowing you to control for confounder5".
Thank you for any help you can provide, and please forgive me if I'm not being clear! Furthermore, this is my first post, so I welcome any constructive criticism on how to pose questions in the future!
Best wishes,
Lewis

Comment