This question relates to the steps one would need to take in order to reproduce an answer from the DoWhy tutorial, using the EconML library code for heterogeneous causal effects.

In DoWhy, there is the following tutorial example to calculate the ATE (average treatment effect) of the Lalonde dataset:


In particular I am concerned with answer:

Causal Estimate is 1634.98683597

This was achieved in DoWhy based on propensity score weighting.

Now, EconML is a library based on Heterogeneous treatment effects, and in particular they advocate for "Double Machine Learning" models of the sort:

\begin{equation} \begin{split}Y =~& \theta(X) \cdot T + g(X, W) + \epsilon ~~~&~~~ \mathbb{E}[\epsilon | X, W] = 0 \\ T =~& f(X, W) + \eta & \mathbb{E}[\eta \mid X, W] = 0 \\ ~& \mathbb{E}[\eta \cdot \epsilon | X, W] = 0\end{split} \end{equation}

where where some treatment(s)/intervention(s)/action(s) $T$ were chosen and some outcome(s) $Y$ were observed and all the variables $W$ that could have potentially gone into the choice of $T$, and simultaneously could have had a direct effect on the outcome $Y$ (aka controls or confounders) are also recorder in the dataset.


In this model the "causal estimate" is reflected in parmeter $\theta(X)$. Heterogeniety arises because this is a function of $X$ - our required observable characteristics.

Naturally one can transform a problem based on CATE (conditional average treatment effect - which considers heterogeneity), to ATE by the law of iterated expectations:

\begin{equation} \mathbb{E}[Y(1) - Y(0)] = \mathbb{E}\left[\mathbb{E}[Y(1) - Y(0) \mid X ]\right] \end{equation}

Therefore it seems one should be able to transform CATE estimates into ATE estimates (i.e. use the EconML library to reproduce answers from DoWhy). However I'm not sure how to get an answer of $\theta(X) = 1634.986$ in this situation.

I've considered the following:

  • Evidently $\theta(X)$ is a function of $X$, but ATE estimates are not. Therefore can I input something like X = numpy.ones(N), to force the $\theta$ estimate to behave constant wrt $X$?

  • Perhaps I can try to remove the heterogeniety by off-loading $X$ into set $W$, and then making the left over $X$ in $\theta(X)$ to be random noise? i.e. X = numpy.random.randn(N)?


Essentially I can't see a straightforward / intuitive way to transform the causal estimate from Double Machine Learning (using EconML) to the equivalent ATE estimate - where I use this Lalonde causal estimate of ATE = 1634.986 as the example.

Does anyone have any idea how this problem should be approached?


1 Answer 1


LinearDML in econml also accepts X=None. In that case a constant effect is estimated which can be recovered by calling: est.effect() With no arguments. Or effect_inference() if you want full inference info.

Also even if you specify an X so as to allow for effect heterogeneity you can also recover the ate by calling: est.ate(X) And est.ate_inference(X)

Where X contains all the samples over which you want to calculate an average effecy

  • 2
    $\begingroup$ Could you explain where these functions come from? $\endgroup$
    – jcken
    Commented Mar 27, 2021 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.