doubleml-for-py icon indicating copy to clipboard operation
doubleml-for-py copied to clipboard

[Feature Request]: Multiple and continuous treatments

Open kkckk1110 opened this issue 5 months ago • 1 comments

Describe the feature you want to propose or implement

Hello, thank you for developing such a useful package! I'd like to ask that, how can I estimate the ATE with multiple continuous treatments with this package? Is it possible? Thanks a lot for your attention!

Propose a possible solution or implementation

No response

Did you consider alternatives to the proposed solution. If yes, please describe

No response

Comments, context or references

No response

kkckk1110 avatar Jun 08 '25 02:06 kkckk1110

Hi @kkckk1110,

Thank you for your question about the DoubleML package. I think the DoubleMLPLR model is suitable for the proposed problem (continous treatment, ATE). It can handle multiple treatment variables and estimates one average effect for each treatment. For each treatment, the passed learner for ml_m is cloned and fitted. The other treatments are also used as covariates as long as use_other_treat_as_covariate is set to True (default) when the DoubleMLData object is created, e.g. two treatments $D_1$ and $D_2$, the treatment $D_2$ is used as control variable when estimating the effect of $D_1$ and vice versa. There was a similar issue some time ago where you might be able to find some more information. Usually, we would recommend to fit multiple models for each treatment separately.

Best regards Jan

JanTeichertKluge avatar Jun 11 '25 08:06 JanTeichertKluge

Hi @kkckk1110,

Was my answer from last month helpful and did it solve your problem? If so, I would close the issue here.

Best regards Jan

JanTeichertKluge avatar Jul 25 '25 14:07 JanTeichertKluge

@JanTeichertKluge Thank you for the reply! I tried the following codes to estimate the treatment effects with instrument variables. In my data, D1-D4 and IV1-IV4 are all continuous variables. Am I correct with this way?

np.random.seed(3141)
  learner = XGBRegressor()
  ml_l = clone(learner)
  ml_m = clone(learner)
  ml_r = clone(learner) 
  obj_dml_data = dml.DoubleMLData(data, y, ['D1', 'D2', 'D3', 'D4'], 
                                  z_cols=['IV1', 'IV2', 'IV3','IV4'], 
                                  x_cols = controls)
  dml_pliv_obj = dml.DoubleMLPLIV(obj_dml_data, ml_l, ml_m, ml_r)
  dml_iv = dml_pliv_obj.fit().summary

kkckk1110 avatar Sep 11 '25 08:09 kkckk1110

Hi @kkckk1110, In principle, the model works as shown in your code. However, depending on your data, you should note that you (may) want to do valid simultaneous inference for multiple treatment variables. The doubleml-for-py package includes solutions for that, e.g. inference can be based on a multiplier bootstrap procedure or p-adjustments like Romano-Wolf or Bonferroni correction can be used.

Please see

https://docs.doubleml.org/stable/guide/se_confint.html#confidence-bands-and-multiplier-bootstrap-for-valid-simultaneous-inference

or, when using different models

https://docs.doubleml.org/stable/guide/se_confint.html#simultaneous-inference-over-different-doubleml-models-advanced

JanTeichertKluge avatar Sep 11 '25 11:09 JanTeichertKluge

Thank you for your instructions.

kkckk1110 avatar Sep 12 '25 06:09 kkckk1110