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.74k stars 475 forks source link

Issue on page /19-Evaluating-Causal-Models.html #208

Closed arthurtobler closed 2 years ago

arthurtobler commented 2 years ago

Thanks a lot for your excellent content!

Just wanted to highlight a potential issue in the code in chapter 19. In the code below, I think you mixed m1 and m2 in the assign method. It makes the interpretation of the results presented in the chapter quite confusing.

prices_rnd_pred = prices_rnd.assign(**{
    "m1_pred": m2.predict(prices_rnd[X]), ## predictive model
    "m2_pred": predict_elast(m1, prices_rnd), ## elasticity model
    "m3_pred": np.random.uniform(size=prices_rnd.shape[0]), ## random model
})

This code is located just before the section Elasticity by Model Band

matheusfacure commented 2 years ago

Oh boy. You are right, thanks!