bcallaway11 / did

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

Universal base period in stata #105

Closed taiwoakinyemi closed 2 years ago

taiwoakinyemi commented 2 years ago

HI, I wonder if there is a way to include the universal base period in stata csdid.

bcallaway11 commented 2 years ago

I added an issue about this to the csdid github, it is here: friosavila/csdid_drdid#29.

I think this is not currently available on Stata, but let’s see what they say.

Brant

friosavila commented 2 years ago

Thank you Brantly So, for the Stata version, I gave it a different name. When you use csdid, you need to use the option "long". It will reproduce what DID does for the universal base period.

bcallaway11 commented 2 years ago

👍 Thank you!

Brant

taiwoakinyemi commented 2 years ago

Hi Fernando,

Thanks for the update. I was expecting the coefficients for the universal base period to be 0 but it is not.

Another issue I have is the command code, when I used the below command lines I get different results, which is the more appropriate? csdid wealthscore hheadage under5 i.state, time(syear) gvar(pyear) method(drimp) long saverif(rif) replace estat all estat event, window(-5 5) csdid_plot image However, when I used the below command and when I did not specify option(long) the results are similar. csdid wealthscore hheadage under5 i.state, time(syear) gvar(pyear) method(drimp) option(long) saverif(rif) replace estat all estat event, window(-5 5) csdid_plot image

bcallaway11 commented 2 years ago

Hi,

Yes, when you use the universal base period, the estimate in the pre-treatment period (i.e., e=-1) should be equal to 0. I'm guessing this is some issue with just getting the Stata syntax correct, but I'm not sure what the answer is. I saw you posted this on the csdid issues page too. I think they'll be able to help you with this one.

Brant

friosavila commented 2 years ago

So, it is really a programming design in how I approached this. Usually, you have the following:

Time =  1  2  3  4  5  6
Treat =  0  0  0  1  1  1

The Universal base in DID compares Everything with Time 3:

ATT(t-3) = T1-T3
ATT(t-2) = T2-T3
ATT(t-1) = T3-T3
ATT(t+0) = T4-T3
ATT(t+1) = T5-T3
ATT(t+2) = T6-T3

I, however, did it following a slightly different nomenclature:

ATT(t-2) = T3-T1
ATT(t-1) = T3-T2
ATT(t+0) = T4-T3
ATT(t+1) = T5-T3
ATT(t+2) = T6-T3

Basically Omitting the base period

bcallaway11 commented 2 years ago

Hi Fernando,

Yes, I totally agree with this --- it's not unique what to do in pre-treatment periods. In R, the default is "varying" and it is a different variation from either of the ones you mention. It reports

ATT(t-2) = T2-T1
ATT(t-1) = T3-T2

and the same in post-treatment periods.

In my view, the "universal" base period one is kind of weird. I think this is mainly just a legacy from event study regressions where this is more-or-less just what you can easily get the regression to report. Importantly, the pre-treatment estimates are not actually any kind of ATT parameter. The thing that this works well for is just visualizing the trend in the data; and, actually, I only think think that case works well if you have unit-specific linear trends (which...I am not sure where these come from either...).

I think the "varying" base period is the one that people should use in most applications (this is why it's the default). In particular, you can see things like anticipation effects in that one much more clearly.

I have post on my website about all this here

taiwoakinyemi commented 2 years ago

Thanks, Brant and Fernando.