I am using the -csdid- command for DID regression.
-ssc install drdid-
-ssc install csdid-
Details of my data:
-Repeated cross section for 2010--2022 with gap of 2 years (except between 2018 and 2022 when the gap is 4 years).
-Treatment is given all at once in 2018 at the district level.
-Data is at individual level (repeated cross section): if you are in a treated district, I assume you are a treated individual.
-I am looking at individual-level outcomes
I was earlier using -didregress- but I kept getting errors in running pretrends/trendplots subcommands. I set up my did like this:
gen treated=1 if selected_district==1 //identifying treated units
replace treated=0 if selected_district!=1
gen treatpost=0
replace treatpost =1 if year>=2018 & treated==1 //interaction between treatment and time
didregress (outcome) (treatpost), time(year) group(distID) vce(cluster distID)
estat pretrends
estat trendplots
The error said "Treatment times vary" even though treatment was given all at once. I figured the problem was that the sample size in 2022 was larger than in 2018. As a result there were more "treated" units in 2022 than in 2018: I took it to mean that Stata considers this as the treatment being staggered. Using -csdid- solved this problem, and the command also ran much faster.
My questions:
1. Is csdid valid for single treatment timing as well?
2. Are there any papers which show that csdid works with single treatment in repeated cross section settings?
3. If answer to 1 is no, how can I tweak my didregress to avoid the staggered DID problem? I have used reghdfe also but I prefer using a built-in command as it makes getting parallel trend plots/tests easier.
-ssc install drdid-
-ssc install csdid-
Details of my data:
-Repeated cross section for 2010--2022 with gap of 2 years (except between 2018 and 2022 when the gap is 4 years).
-Treatment is given all at once in 2018 at the district level.
-Data is at individual level (repeated cross section): if you are in a treated district, I assume you are a treated individual.
-I am looking at individual-level outcomes
I was earlier using -didregress- but I kept getting errors in running pretrends/trendplots subcommands. I set up my did like this:
gen treated=1 if selected_district==1 //identifying treated units
replace treated=0 if selected_district!=1
gen treatpost=0
replace treatpost =1 if year>=2018 & treated==1 //interaction between treatment and time
didregress (outcome) (treatpost), time(year) group(distID) vce(cluster distID)
estat pretrends
estat trendplots
The error said "Treatment times vary" even though treatment was given all at once. I figured the problem was that the sample size in 2022 was larger than in 2018. As a result there were more "treated" units in 2022 than in 2018: I took it to mean that Stata considers this as the treatment being staggered. Using -csdid- solved this problem, and the command also ran much faster.
My questions:
1. Is csdid valid for single treatment timing as well?
2. Are there any papers which show that csdid works with single treatment in repeated cross section settings?
3. If answer to 1 is no, how can I tweak my didregress to avoid the staggered DID problem? I have used reghdfe also but I prefer using a built-in command as it makes getting parallel trend plots/tests easier.
Comment