DataCanvasIO / YLearn

YLearn, a pun of "learn why", is a python package for causal inference
https://ylearn.readthedocs.io
Apache License 2.0
391 stars 75 forks source link

How to compute CATE for continous treatment? #47

Closed Lllllp93 closed 8 months ago

Lllllp93 commented 1 year ago

Hi, I'm new to YLearn and Causal Inference, really appreciate your job. I have some questions as shown below

  1. How to compute CATE with Ylearn? Is this realized by input corresponding test_data in 'why.causal_effect(test_data)'?

  2. What's the difference between adjustments and covariate? Is covariate same as effect_modifier in dowhy? It seems like YLearn threat all adjustments and covariates as the input of estimator by get_wv(w, v)

  3. How to find the covariate with YLearn.model.CausalModel,?

BochenLv commented 1 year ago

Hi,

Thanks for the questions.

  1. The computation of CATE can be done by passing the test data (the training data will be used if the test data is not provided) to the method estimate of any estimator models such as CausalForest. As you suggested, why.causal_effect() is the method for computing CATE if you are using Why.
  2. Roughly speaking, both covariates and adjustments influence the treatment and outcome simultaneously, i.e., they are confounders of the treatment and outcome according to the Pearl's causal framework, except for that covariates are necessary for estimating the causal effect (or CATE in your questions) in test data while adjustments are not.
  3. For the same reason, CausalModel does not distinguish covariates and adjustments in the sense that CausalModel directly identifies them as the backdoor adjustment set of the causal effect of the treatment on the outcome. This process can be done with the identify method of the CausalModel where the corresponding identify method should be backdoor adjustment. The difference between covariates and adjustments only appears in the estimation of causal effect level.
Lllllp93 commented 1 year ago

Sorry for the late response and thanks for the answers. I have another question is how can we treat the CATE of continous treatment as nonlinear.

As far as I know, methods like DML or DR assume the causal effect is linear. For example, DML results tell me that every $1 decrease in price, the sales volume will increase by 100 pieces. Maybe this result is applicable to a certain range(like from $10 to $20) , but of course, we cannot reduce the price without limitation. So I believe the causal effect of continous treatment is nonlinear in most cases, but how to figure out this?

One way to do this I think is to build a predictor with treatment and backdoor vars like P(outcome | treatment,backdoor_vars),and then we can compute effect by P(outcome | treatment=$20,backdoor_vars) - P(outcome | treatment=$10,backdoor_vars) . But there is not too much causality things and maybe include bias and overfitting.

I would appreciate it if you could kindly help me.