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.77k stars 482 forks source link

Chapter 15 says OLS but it isn't OLS, it's regularised #414

Open ellisp opened 2 months ago

ellisp commented 2 months ago

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

To do this with linear regression, we will find the weight using OLS. We will minimise the square distance between the weighted average of the units in the donor pool and the treated unit for the pre-intervention period.

In fact, OLS wouldn't work because you have 38 states and only 19 years. You use the default sklearn.linear_model, which applies regularization by default. If you don't know this, it probably means that a lot of the time you think you are doing OLS you actually are getting estimates that have been shrunk to zero instead.