I have started looking into causal inference, in particular Dowhy package based on Judea Pearls book of why. What i don't understand is how the counterfactual is estimated?

My understanding is that DoWhy package (based on judea pearl book) addresses counterfactuals by creating a bayesian graphical model (at very high level) but i don't understand the math of how this is done. Can anybody point me in right direction of how it is estimated?

Step 2 in the 4 step process also confuses me. When we say step 2 is 'identification' do we mean that the graphical model tries to write the structure of model we feed it in a probabilistic way?

Any light somebody could shed on how counterfactual is created using dowhy/judea pearl way would be great.


The four Steps of causal inference.

  1. Modelling: create a causal graph to encode assumptions a. This is about creating a causal graph that encodes our assumptions that we are bringing in from our domain knowledge and our knowledge about how world works to augment data that we are using
  2. Identification: formulate what to estimate a. Here we are going to be taking those assumptions in causal graph and model and using it to formulate what we need to estimate
  3. Estimation: compute the estimate a. Given all the realities of the dataset what is the best way to trade off the bias and variance for whatever task we’re trying to do to get a causual estimate of what is the impact of doing one thing vs the other on outcomes we care about
  4. Refutation: validate the assumptions a. Lets see if we can refute the estimate i.e. come up with a reason not to trust it
  • $\begingroup$ Can you please provide a reference as to the "steps" to which you are referring? $\endgroup$ Jul 5, 2022 at 12:06
  • $\begingroup$ microsoft.com/en-us/research/blog/… @AdrianKeister $\endgroup$
    – Maths12
    Jul 5, 2022 at 12:42
  • $\begingroup$ It would be good if you could type up at least a summary of those steps, and add it to the body of your question. $\endgroup$ Jul 5, 2022 at 14:18
  • 1
    $\begingroup$ @AdrianKeister i've added the 4 steps to best of how i understand it $\endgroup$
    – Maths12
    Jul 5, 2022 at 15:32

1 Answer 1


The "identification" step refers to identifying an estimator for the quantity of interest and whether or not it can be computed given the causal model. For example, if there are unknown confounders, or undirected edges in a causal graph, an effect may not be identifiable.

A counterfactual is estimated by changing the value of a given set of nodes, leaving the rest in their "factual" state, and re-computing the state of the system. It is similar to an intervention, with the important difference that we are interested in the alternative state of the system, rather than only the change due to the intervention. This requires knowledge about the values of the other system variables that are not intervened upon.


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.