bcallaway11 / did

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

event time argument in honest_did function #119

Open bcallaway11 opened 2 years ago

bcallaway11 commented 2 years ago

Setting the argument e in the honest_did function causes it to crash. Not sure what is going on here. For example, the following code crashes:

# Doing it for instantaneous treatment effect,  e=0
hd_cs_rm_never <- honest_did(CS_es_never_cond,
                             e=0,
                             type="relative_magnitude")

Run that after running code in: #115

bcallaway11 commented 2 years ago

Just realized that this is related to the way that R autocompletes argument names. In particular, e should be going through the ... argument, but gets put into the es argument here (which is where CS_es_never_cond should be).

A fix for this is to instead run:

hd_cs_rm_never <- honest_did(es=CS_es_never_cond,
                             e=0,
                             type="relative_magnitude")

This is fine, but it will be confusing to users if the original code doesn't work.