matheusfacure / python-causality-handbook

Causal Inference for the Brave and True. A light-hearted yet rigorous approach to learning about impact estimation and causality.
https://matheusfacure.github.io/python-causality-handbook/landing-page.html
MIT License
2.61k stars 456 forks source link

the weights of Synthetic Difference-in-Differences #327

Closed wbaz4321 closed 1 year ago

wbaz4321 commented 1 year ago

There is an issue on chapter 25, in the following paragraph

These unit weights also define a synthetic control that we can plot alongside the outcome of California. We’ll also plot the traditional synthetic control we’ve estimated earlier alongside the one we’ve just estimated plus the intercept term. This will give us some intuition on what is going on and the difference between what we just did and traditional Synthetic Control.

The code to draw the graph is: sc_did = data_piv.drop(columns="california").values @ unit_weights.values

However, I have a question:

I do not really understand why it is the unit weights that are used to estimate the sc_did values shown in the graph. I checked the codes, there are time weights and unit weights, and I found that when the time weights are obtained, they are only used when computing the ATT, i.e., the texts are "Finally, all we have to do is estimate a Diff-in-Diff model with the weights we’ve just defined ..."

So, the time weights are not used in computing the sc_did when visualizing results?? if so, why not? Any suggestion will be much appreciated~

matheusfacure commented 1 year ago

So, the time weights are not used in computing the sc_did when visualizing results??

Its hard to visualise the usage of the time weights. The way I did it was defining the start point of the purple lines.

image

They start at the weighted average pre-treatment period, where weights are the time weights.