Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Сausal effect for non-linear relationship #1054

Closed
sinya2 opened this issue Oct 30, 2023 · 1 comment
Closed

Сausal effect for non-linear relationship #1054

sinya2 opened this issue Oct 30, 2023 · 1 comment
Labels
question Further information is requested

Comments

@sinya2
Copy link

sinya2 commented Oct 30, 2023

Few years ago it was an assumption that in the later versions would be possibility to evaluate causal effect depends on value of the treatment.
For example, E( outcome=1|t=k)-E(outcome|t=k-1)) for any k.

Is it implemented now? Where I could find the examples?

Thank you!

@sinya2 sinya2 added the question Further information is requested label Oct 30, 2023
@amit-sharma
Copy link
Member

amit-sharma commented Nov 4, 2023

Yes, the functionality to specify control and treatment values for a continuous treatment variable is implemented now.
For an example, check out cell 7 this notebook: https://www.pywhy.org/dowhy/v0.10.1/example_notebooks/dowhy-conditional-treatment-effects.html

tval1, tval2 = 10, 20
linear_estimate = model.estimate_effect(identified_estimand,
                                        method_name="backdoor.linear_regression",
                                       control_value=tval1,
                                       treatment_value=tval2)

For a non-linear relationship, the same API is used, just the estimator is changed.

dml_estimate = model.estimate_effect(identified_estimand, method_name="backdoor.econml.dml.DML",
                                     control_value = 0,
                                     treatment_value = 1,
                                 target_units = lambda df: df["X0"]>1,  # condition used for CATE
                                 confidence_intervals=False,
                                method_params={"init_params":{'model_y':GradientBoostingRegressor(),
                                                              'model_t': GradientBoostingRegressor(),
                                                              "model_final":LassoCV(fit_intercept=False),
                                                              'featurizer':PolynomialFeatures(degree=1, include_bias=False)},
                                               "fit_params":{}})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants