kylebutts / did2s

Two-stage Difference-in-Differences package following Gardner (2021)
http://kylebutts.github.io/did2s
Other
93 stars 21 forks source link

Fixed Intercept of Zero and Implications for Interpretation #33

Closed kdmaclean closed 2 months ago

kdmaclean commented 2 months ago

This is perhaps more of an interpretation question but throughout the documentation, i( ... , ref=...) is used to estimate effects relative to the reference category, as with a traditional dummy variable. However, surprisingly, it will happily estimate both effects FALSE and TRUE if you drop the reference category.

static <- did2s(df_het, 
                yname = "dep_var", first_stage = ~ 0 | state + year, 
                second_stage = ~i(treat), treatment = "treat", 
                cluster_var = "state")
fixest::esttable(static)

image

This is occuring because the second stage call is forcing the intercept to be zero.

fixest::feols(fixest::xpd(~ 0 + ..second_stage, lhs = yname)

That is fine but the interpretation, I don't think, is what is being suggested. For instance, let's say we reverse the reference category and set the reference category to be TRUE. We would expect, that not treated observations are now -2.15 or so, relative to TRUE. But that isn't what occurs due to the zero intercept.

static <- did2s(df_het, 
                yname = "dep_var", first_stage = ~ 0 | state + year, 
                second_stage = ~i(treat,ref="TRUE"), treatment = "treat", 
                cluster_var = "state")
fixest::esttable(static)

image

This seems to me to be more important in event studies. The coefficients don't actually change when a certain reference period is left out and it's not clear to me how it can be claimed that they are "relative" to the reference period if so. Whether I do second_stage = ~ i(rel_year,ref=c(20))

or

second_stage = ~ i(rel_year,ref=c(-1)

the coefficients are identical (and thus, not relative to the left out category). Am I correct on this? I am probably missing something obvious though in the interpretation!

kylebutts commented 2 months ago

Hi @kdmaclean,

I thought I had fixed the docs ages ago; but clearly not. The example README should not be using -1 as a reference value. It is a bit confusing and my intuition led me astray too when I was first writing this package.

What the secondstage is doing is summarizing $y{it} - \hat{y}{it}(0)$ where $\hat{y}$ is the fitted value from the first-stage. So when you regress that on a set of event-time dummy variables, you are just taking averages of $y{it} - \hat{y}_{it}(0)$ for different sets. No need to omit any. The reason you do in TWFE estimated via OLS is because they are collinear with unit and time fixed effects.

You can just not average for -1 and it won't affect anything because again there is no reference category. But you should not do that and plot a 0 estimate for -1 because that's not accurate.

Hope that clarifies and I have updated the README examples.