Within the final couple of substacks, I walked us by the decomposition of the two-way mounted results (TWFE) estimator when the remedy is steady and the design is difference-in-differences. I even made a shiny app for instance it, which you’ll take a look at right here. We realized this formulation:
(beta^{textual content{twfe}} ;=; int_{d_L}^{d_U} underbrace{frac{(l – E[D]) cdot f_D(l)}{textual content{Var}(D)}}_{w^{textual content{lev}}(l)} cdot [m(l) – m(0)], dl)
That is going to be the core formulation that I’m going to study greatest though it is just one of many 4 decompositions that the authors report in their paper (Desk 1).
Discover then that the TWFE coefficient principally has 4 distinct items:
-
integrating over doses. The TWFE is a weighted common over the help of the remedy dosage. That makes use of the density f_D(l) to map out help over l, the remedy dosage values.
-
the load. There’s three items to the load. There’s the re-centering of the dose, l-E[D]. This takes a selected unit’s dosage and subtracts the imply over your complete pattern. So perhaps my dose is 0.1 however the imply 1, then the recentering can be 0.1-1 or -0.9. Discover there that the recentering introduces a adverse worth although — if you’re under the imply, that’s mechanically adverse.
-
variance. And final, the variance of the dose itself rescales the load.
-
lengthy differenced outcomes. The final piece is m(l)-m(0), the place m() is the result of curiosity.
In the present day what I need to do is pretty simple. I need to use our dataset Lu & Yu (2015), estimate two-way mounted results, report that, after which reconstruct the identical coefficient utilizing the weighted common of the differenced m(l)-m(0), the place the weights are these scaled recentered doses I simply talked about.
However first, I flipped a coin 3 times, and as soon as once more, it got here up heads twice. As that is primarily a diff-in-diff publish in the present day, and fewer so a Claude Code publish, I’m going to paywall it. However perhaps in the present day contemplate turning into a paying subscriber! However as a teaser, right here’s the video of the up to date shiny app so as to see what’s under.
