Hello Statalist Community,
I am employing a stacked regression approach as the post-stimation to my staggered DiD. However, I am having some doubts on how to run the TWFE regression on the stacked dataset.
The way I did it was: I defined -a=5 and b=5 same sized datasets, for each year my treatment occured. Then, I removed the already treated units on each dataset (even regimes that were already treated in -a>5). Then, I appended all datasets. Up to here all makes sense (but do correct me if i’m wrong).
However, I am having some doubts about how to run the TWFE regression on the stacked dataset. May I ask if this the correct way to go about the xtset? And do I need to change anything else in the original TWFE other than the clustered variable? I cannot simply use the xtset on country year. I need to include country in the context of the dataset_id, so I created a new group: countrydataset_pair. I didn’t change the year because this year already corresponds to the years between the -a, b time frame, so I supposed I didn’t have to make any changes — but I am not sure about this. This is how I did it using Stata:
egen countrydataset_pair = group(dataset_id country)
xtset regimedataset_pair year
xtreg dv iv controls i.year, fe vce(cluster regimedataset_pair)
(the original TWFE with the original non-stacked dataset)
xtset country year
xtreg dv iv controls i.year, fe vce(cluster country)
Thank you so much!
I am employing a stacked regression approach as the post-stimation to my staggered DiD. However, I am having some doubts on how to run the TWFE regression on the stacked dataset.
The way I did it was: I defined -a=5 and b=5 same sized datasets, for each year my treatment occured. Then, I removed the already treated units on each dataset (even regimes that were already treated in -a>5). Then, I appended all datasets. Up to here all makes sense (but do correct me if i’m wrong).
However, I am having some doubts about how to run the TWFE regression on the stacked dataset. May I ask if this the correct way to go about the xtset? And do I need to change anything else in the original TWFE other than the clustered variable? I cannot simply use the xtset on country year. I need to include country in the context of the dataset_id, so I created a new group: countrydataset_pair. I didn’t change the year because this year already corresponds to the years between the -a, b time frame, so I supposed I didn’t have to make any changes — but I am not sure about this. This is how I did it using Stata:
egen countrydataset_pair = group(dataset_id country)
xtset regimedataset_pair year
xtreg dv iv controls i.year, fe vce(cluster regimedataset_pair)
(the original TWFE with the original non-stacked dataset)
xtset country year
xtreg dv iv controls i.year, fe vce(cluster country)
Thank you so much!