Untitled

En español

In this post I want to share with you some introductory ideas on how Directed Acyclical Graphs (DAGs) are used for causal identification. I am also sharing a few (Stata based) numerical simulations (here), that can be illustrative of their use in a regression application.

The DAG approach has been around for more than fifteen years now, and is described in extent in the excellent book by Pearl and Mackenzie (2018)’s “The Book of Why”. There's so much going on in the book that I will be writing more about it in a future post.

For those that are completely unfamiliar with the framework, DAGs are used to represent assumptions on the causal relationship between theoretical constructs (and their variables), and then, using the resulting graphs, to identify causal identification strategies. In observational settings, where we are used to think about possible confounders which introduce bias in the measured effects of interest, Pearl’s approach proposes a method on how and when to de-confound.

Let me give a few examples on how these graphs work, and what the simulations I am attaching show.

Let's assume that we are in an observational setting and are interested in the identification of the effect of variable X on variable Y. Let's also assume that there is also a variable Z which has an effect on X and Y. This is the basic story on the well known confounder bias idea, and is represented in the following graph:

img

In order to identify the effect of X on Y we need to control for Z. Controlling for Z, which consists in examining the relationship between X and Y, having fixed the value of Z, blocks the confounder effect of Z. (1). Confounding occurs because there is an alternative path that connects X and Y. Pearl uses the analogy of a pipe: the idea is that incorporating Z as a control blocks the alternative pipe X<=Z=>Y. In referring to this alternative path he also refers to it as a "back-door path".

In a regression framework adding controls is equivalent to adding the variable as an explanatory regressor. For the following simulated scenario, let’s assume that there is no causal relationship between X and Y, and that both variables are (linearly) influenced by by the confounder. For instance, assume that

Where , and are random uniform noise.

Now assume that, in trying to identify the effect of X on Y we estimate the model where we ommit Z. The result is:

1563215858466

 

The coefficient for X suggests that there is a negative effect. This is actually not surprising giving our model: if Z has a negative effect on X and a positive effect on Y, in the absence of Z a negative relationship between X and Y is observed.

Now lets add the control for Z, and estimate:

img

We can see that the spurious effect disappears: the coefficient for X is now close to 0, and the coefficient for X is close to 3.

Bad control: introducing a collider

Consider now the following example, which is a slightly modified version of one of the cases introduced in the book.

img

In this situation, a possible pipe connects X and Y. This is the pipe X=>A<=Z=>Y. But there is something special about this pipe. Whenever there is a node when two causal connections collide (such as in: =>A<=), there is no possible flow of information. This is what Pearl calls a collider. Then, if that were the unique relevant pipe in the flow, there would be no need of adding controls, because the pipe is already blocked.

The problem appears if you control for A. The effect of controlling with a collider is the opposite: controlling for A will open the pipe and allow the flow of information through the confounding pipe.

Now lets implement this situation in a simple simulation. Lets assume

Where and is random noise.

 

Let's first note that we do not need to introduce controls when identifying the effect of X on Y.

img

Now, if A is added as control, the back-door path is opened, and a bias emerges!

img

We can close the back-door path again, by also controlling for B.

1563216445747

 

In the github repository you will find some more examples. I will be adding more real examples in the future, as well as more comments in the book, so stay tuned! If you are interested in these methodologies don't go without leaving your comments.

  1. More precisely, the relationship between X and Y would be evaluated at each level of Z, and the an average weighting the relative importance of each value of Z would be performed

 

Leave a Reply

Your email address will not be published. Required fields are marked *