bcallaway11 / did

Difference in Differences with Multiple Periods, website: https://bcallaway11.github.io/did
287 stars 91 forks source link

Multiple Treatment Types #162

Open mikenguyen13 opened 1 year ago

mikenguyen13 commented 1 year ago

Hi, I am trying to implement the package to the setting of multiple treatment types (e.g., treatment 1, treatment 2, etc.). And each unit can have a different treatment combination. I was wondering how I could apply your package in this setting. Naively, I thought I could create the gname column so that it could be treatment1_2006, treatment2_2006, treatment1_2007 and so on. But then, I realize gname has to numeric:

Error in pre_process_did(yname = yname, tname = tname, idname = idname,  : 
  data[, gname] must be numeric

Hence, I was wondering if you could suggest a way to apply your code to the multiple treatment types setting. I really appreciate your time.

bcallaway11 commented 1 year ago

This is a good question, and I don't think there is a way to do this well. In a staggered treatment setting, groups are defined by the time period when they become treated.

It doesn't have to be this way, though allowing for "general" groups becomes a substantially more intractable problem; for example, it is no longer straightforward to aggregate the treatment effects into an overall treatment effect parameter or event study.

One possible idea is to just split your data according to each distinct combination of treatments + the comparison group, and run our code separately on each subset.

I'm going to tag this as a possible future enhancement. If you have thoughts, I'd be interested to hear them.

Thanks, Brant

mikenguyen13 commented 1 year ago

Thank you for your time and suggestion. I am following your suggestion by creating sub-samples then use stacked regression. It's just that I feel like this may be the most elegant approach and reusing the same control group may pose a problem. I am looking forward to this future enhancement.

Thank you again!

simonschoe commented 11 months ago

+1

I would also love to see an option to accomodate different treatment types using did instead of implementing a stacked regression design.

bcallaway11 commented 11 months ago

Thanks, this is on our radar!

Brant