Hi all,
I am trying to set up a staggered difference in difference using the CSDID package. I have sample code and data below which produces the attached figure . Thank you all so much and apologies if these are too basic.
1) I am a little confused how the control group is represented in this staggered DiD figure (since the intervention does not occur in the control group and the intervention is staggered ). Is each treatment sample matched with a control sample based on the raw value of the time variable? In other words, in each time period, what is the outcome variable in the treatment group being compared to in order to generate the ATT?
2) I would also like to plot the raw values of (outcome in control group) , (outcome in treatment group) and (raw quarter) in each "time to event" period but can't figure out how to do that.
Sample Code
csdid outcome, ivar(id) time(quarter) gvar(quartertreated )
estat event, window(-4 4) estore(cs)
event_plot cs, default_look graph_opt(xtitle("Quarters Relative to Event") ytitle("Average effect") ///
title("ATT Difference in Difference") xlabel(-4(1)4)) stub_lag(Tp#) stub_lead(Tm#) together
Description of variables
id=sample ID
quarter =a sequential time period starting from zero, same for all observations,
eventquarter=the quarter an event happened for treatment , missing otherwise
state= the state the sample is in
outcome=the outcome of interest
var1, var2= only two listed for simplicity but covariates I am hoping to adjust for in a propensity score
treatment= whether a sample is ever in the treatment group
data
[CODE]
* Example generated by -dataex-. For more info, type help dataex
clear
input str4 id byte quarter float eventquarter str2 state int(outcome var1 var2) float treatment
"288" 9 . "NY" 0 1 1 0
"288" 10 . "NY" 0 3 7 0
"288" 11 . "NY" 0 3 6 0
"277" 12 9 "NY" 0 0 4 1
"277" 13 9 "NY" 0 1 0 1
"277" 16 9 "NY" 0 0 1 1
I am trying to set up a staggered difference in difference using the CSDID package. I have sample code and data below which produces the attached figure . Thank you all so much and apologies if these are too basic.
1) I am a little confused how the control group is represented in this staggered DiD figure (since the intervention does not occur in the control group and the intervention is staggered ). Is each treatment sample matched with a control sample based on the raw value of the time variable? In other words, in each time period, what is the outcome variable in the treatment group being compared to in order to generate the ATT?
2) I would also like to plot the raw values of (outcome in control group) , (outcome in treatment group) and (raw quarter) in each "time to event" period but can't figure out how to do that.
Sample Code
csdid outcome, ivar(id) time(quarter) gvar(quartertreated )
estat event, window(-4 4) estore(cs)
event_plot cs, default_look graph_opt(xtitle("Quarters Relative to Event") ytitle("Average effect") ///
title("ATT Difference in Difference") xlabel(-4(1)4)) stub_lag(Tp#) stub_lead(Tm#) together
Description of variables
id=sample ID
quarter =a sequential time period starting from zero, same for all observations,
eventquarter=the quarter an event happened for treatment , missing otherwise
state= the state the sample is in
outcome=the outcome of interest
var1, var2= only two listed for simplicity but covariates I am hoping to adjust for in a propensity score
treatment= whether a sample is ever in the treatment group
data
[CODE]
* Example generated by -dataex-. For more info, type help dataex
clear
input str4 id byte quarter float eventquarter str2 state int(outcome var1 var2) float treatment
"288" 9 . "NY" 0 1 1 0
"288" 10 . "NY" 0 3 7 0
"288" 11 . "NY" 0 3 6 0
"277" 12 9 "NY" 0 0 4 1
"277" 13 9 "NY" 0 1 0 1
"277" 16 9 "NY" 0 0 1 1
Comment