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.65k stars 463 forks source link

Issue on page /15-Synthetic-Control.html #265

Closed TXU0429 closed 1 year ago

TXU0429 commented 2 years ago

In the code from sklearn.linear_model import LinearRegression weights_lr = LinearRegression(fit_intercept=False).fit(X, y).coef_ weights_lr.round(3)

Isn't it fit(y, X) instead of fit(X, y)?

TimoFlesch commented 2 years ago

Hey, from looking at the API it seems like the order is correct. The predictor comes first: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html#sklearn.linear_model.LinearRegression.fit