I'm working with a staggered Difference-in-Differences (DiD) setup in R using the did
package, where units are treated at different times and some are never treated (i.e., control group). Here's the code I'm using:
att_results <- att_gt(
yname = "ln_Pris",
tname = "Year",
idname = "id",
gname = "treatment_year",
data = clean_data,
panel = FALSE
)
Some units in my data are never treated, so their treatment_year
is NA
. When I run this, it seems like those units are being dropped from the estimation — I assume because gname
is NA
for the control group.
However, I need to include the never-treated units as the control group in the DiD analysis. I noticed there's a control_group
argument in att_gt()
, but I'm not sure how to use it in this situation.
Question:
How can I include never-treated units in the estimation? Do I need to manually assign something to gname
for those units, or is setting control_group = "never treated"
enough?
Thanks in advance!
Put treatment_year = 0
(instead of NA
) for never-treated. You should take a close look at ?att_gt
before using this function. Here is a screenshot from the documentation.