26
$\begingroup$

I have read in several places that the use of DAGs can help to reduce bias due to

  • Confounding
  • Differential Selection
  • Mediation
  • Conditioning on a collider

I also see the term “backdoor path” a lot.

How do we use DAGs to reduce these biases, and how does it relate to backdoor paths ? Extra points (I will award a bounty) for real world examples of the above

$\endgroup$
  • 3
    $\begingroup$ Chapter 6: Hernán, M. A., & Robins, J. M. (Forthcoming, expected 2020, but pre-print available). Causal Inference: What If. Chapman & Hall/CRC. $\endgroup$ – Alexis Jan 20 at 16:55
45
+400
$\begingroup$

A DAG is a Directed Acyclic Graph.

A “Graph” is a structure with nodes (which are usually variables in statistics) and arcs (lines) connecting nodes to other nodes. “Directed” means that all the arcs have a direction, where one end of the arc has an arrow head, and the other does not, which usually refers to causation. “Acyclic” means that the graph is not cyclic – that means there can be no path from any node that leads back to the same node. In statistics a DAG is a very powerful tool to aid in causal inference – to estimate the causal effect of one variable (often called the main exposure) on another (often called the outcome) in the presence of other variables which may be competing exposures, confounders or mediators. The DAG can be used to identify a minimal sufficient set of variables to be used in a multivariable regression model for the estimation of said causal effect. For example it is usually a very bad idea to condition on a mediator (a variable that lies on the causal path between the main exposure and the outcome), while it is usually a very good idea to condition on a confounder (a variable that is a cause, or a proxy for a cause, of both the main exposure and the outcome). It is also a bad idea to condition on a collider (to be defined below).

But first, what is the problem we want to overcome ? This is what a multiple regression model looks like to your favourite statistical software:

enter image description here

The software does not “know” which variables are our main exposure, competing exposures, confounders or mediators. It treats them all the same. In the real world it is far more common for the variables to be inter-related. For example, knowledge of the particular area of research may indicate a structure such as:

enter image description here

Note that it is the researchers job to specify the causal paths, using expert knowledge about the subject at hand. DAGs represent a set of (often abstracted) causal beliefs pertinent to specific causal relationships. One researcher's DAG may be different to another researcher's DAG, for the same relationship(s), and that is completely OK. In the same way, a researcher may have more than one DAG for the same causal relationships, and using DAGs in a principled way as described below is one way to gather knowledge about, or support for a particular hypothesis.

Let’s suppose that our interest is in the causal effect of $X7$ on $Y$. What are we to do? A very naive approach is simply to put all the variables into a regression model, and take the estimated coefficient for $X7$ as our “answer”. This would be a big mistake. It turns out that the only variable that should be adjusted for in this DAG is $X3$, because it is a confounder. But what if our interest was in the effect of $X3$, not $X7$ ? Do we simply use the same model (also containing $X7$) and just take the estimate of $X3$ as our “answer” ? No ! In this case, we do not adjust for $X7$ because it is a mediator. No adjustment is needed at all. In both cases, we may also adjust for $X1$ because this is a competing exposure and will improve the precision of our casual inferences in both models. In both models we should not adjust for $X2$, $X4$, $X5$ and $X6$ because all of them are mediators for the effect of $X7$ on $Y$.

So, getting back to the question, how do DAGs actually enable us to do this ? First we need to establish a few ground truths.

  1. A collider is a variable which has more than 1 cause – that is, at least 2 arrows are pointing at it (hence the incoming arrows “collide”). $X5$ in the above DAG is a collider

  2. If there are no variables being conditioned on, a path is blocked if and only if it contains a collider. The path $X4 \rightarrow X5 \leftarrow X6$ is blocked by the collider $X5$.

Note: when we talk about "conditioning" on a variable this could refer to a few things, for example stratifying, but perhaps more commonly including the variable as a covariate in a multivariable regression model. Other synonymous terms are "controlling for" and "adjusting for".

  1. Any path that contains a non-collider that has been conditioned on is blocked. The path $Y \leftarrow X3 \rightarrow X7$ will be blocked if we condition on $X3$.

  2. A collider (or a descendent of a collider) that has been conditioned on does not block a path. If we condition on $X5$ we will open the path $X4 \rightarrow X5 \leftarrow X6$

  3. A backdoor path is a non-causal path between an outcome and a cause. It is non-causal because it contains an arrow pointing at both the cause and the outcome. For example the path $Y \leftarrow X3 \rightarrow X7$ is a backdoor path from $Y$ to $X3$.

  4. Confounding of a causal path occurs where a common cause for both variables is present. In other words confounding occurs where an unblocked backdoor path is present. Again, $Y \leftarrow X3 \rightarrow X7$ is such a path.

So, armed with this knowledge, let’s see how DAGs help us with removing bias:

  • Confounding

The definition of confounding is 6 above. If we apply 4 and condition on the confounder we will block the backdoor path from the outcome to the cause, thereby removing confounding bias. The example is the association of carrying a lighter and lung cancer:

enter image description here

Carrying a lighter has no causal effect on lung cancer, however, they share a common cause - smoking - so applying rule 5 above, a backdoor path from Lung cancer to carrying a lighter is present which induces an association between carrying a lighter and Lung cancer. Conditioning on Smoking will remove this association, which can be demonstrate with a simple simulation where I use continuous variables for simplicity:

> set.seed(15)
> N <- 100
> Smoking <- rnorm(N, 10, 2)
> Cancer <- Smoking + rnorm(N)
> Lighter <- Smoking + rnorm(N)

> summary(lm(Cancer ~ Lighter)) 

Coefficients:
      Estimate Std. Error t value Pr(>|t|)    
(Intercept)  0.66263    0.76079   0.871    0.386    
Lighter      0.91076    0.07217  12.620   <2e-16 ***

which shows the spurious association between Ligher and Cancer, but now when we condition on Smoking:

> summary(lm(Cancer ~ Lighter + Smoking))  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.42978    0.60363  -0.712    0.478    
Lighter      0.07781    0.11627   0.669    0.505    
Smoking      0.95215    0.11658   8.168 1.18e-12 ***

...the bias is removed.

  • Mediation

A mediator is a variable that lies on the causal path between the cause and the outcome. This means that the outcome is a collider. Therefore, applying rule 3 means that we should not condition on the mediator otherwise the indirect effect of the cause on the outcome (ie that mediated by the mediator) will be blocked. A good example example is the grades of a student and their happiness. A mediating variable is self-esteem:

enter image description here

Here, Grades has a direct effect on Happiness, but it also has an indirect effect mediated by self-esteem. We want to estimate the total causal effect of Grades on Happiness. Rule 3 says that a path that contains a non-collider that has been conditioned on is blocked. Since we want the total effect (ie including the indirect effect) we should not condition on Self-estem otherwise the mediated path will be blocked, as we can see in the following simulation:

> set.seed(15)
> N <- 100
> Grades <- rnorm(N, 10, 2)
> SelfEsteem <- Grades + rnorm(N)
> Happiness <- Grades + SelfEsteem + rnorm(N)

So the total effect should be 2:

> summary(m0 <- lm(Happiness ~ Grades)) # happy times

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.05650    0.79509   1.329    0.187    
Grades       1.90003    0.07649  24.840   <2e-16 ***

which is what we do find. But if we now condition on self esteem:

> summary(m0 <- lm(Happiness ~ Grades + SelfEsteem

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.39804    0.50783   2.753  0.00705 ** 
Grades       0.81917    0.10244   7.997 2.73e-12 ***
SelfEsteem   1.05907    0.08826  11.999  < 2e-16 ***

only the direct effect for grades is estimated, due to blocking the indirect effect by conditioning on SelfEsteem.

  • Collider bias

This is probably the most difficult one to understand, but with the aid of a very simple DAG we can easily see the problem:

enter image description here

Here, there is no causal path between X and Y. However, both cause C, the collider. If we condition on C, then applying rule 4 above we will invoke collider bias by opening up the (non causal) path between X, and Y. This may be a little hard to grasp at first, but it should become apparent by thinking in terms of equations. We have X + Y = C. Let X and Y be binary variables taking the values 1 or zero. Hence, C can only take the values of 0, 1 or 2. Now, when we condition on C we fix its value. Say we fix it at 1. This immediately means that if X is zero then Y must be 1, and if Y is zero then X must be one. That is, X = -Y, so they are perfectly (negatively) correlated, conditional on C= 1. We can also see this in action with the following simulation:

> set.seed(16)
> N <- 100
> X <- rnorm(N, 10, 2)
> Y <- rnorm(N, 15, 3)
> C <- X + Y + rnorm(N)

So, X and Y are independent so we should find no association:

> summary(m0 <- lm(Y ~ X))

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 14.18496    1.54838   9.161 8.01e-15 ***
X            0.08604    0.15009   0.573    0.568    

and indeed no association is found. But now condition on C

> summary(m1 <- lm(Y ~ X + C))

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.10461    0.61206   1.805   0.0742 .  
X           -0.92633    0.05435 -17.043   <2e-16 ***
C            0.92454    0.02881  32.092   <2e-16 ***

and now we have a spurious association between X and Y.

Now let’s consider a slightly more complex situation:

enter image description here

Here we are interested in the causal effect of Activity on Cervical Cancer. Hypchondria is an unmeasured variable which is a psychological condition that is characterized by fears of minor and sometimes non-existent medical symptoms being an indication of major illness. Lesion is also an unobserved variable that indicates the presence of a pre-cancerous lesion. Test is a diagnostic test for early stage cervical cancer. Here we hypothesise that both the unmeasured variables affect Test, obviously in the case of Lesion, and by making frequent visits to the doctor in the case of Hypochondria. Lesion also (obviously causes Cancer) and Hypochodria causes more physical activity (because persons with hypochondria are worried about a sedentary lifestyle leading to disease in later life.

First notice that if the collider, Test, was removed and replace with an arc either from Lesion to Hypochodria or vice versa, then our causal path of interest, Activity to Cancer, would be confounded, but due to rule 2 above, the collider blocks the backdoor path $\text{Cancer}\leftarrow \text{Lesion} \rightarrow \text{Test} \leftarrow \text{Hypochondria} \rightarrow \text{Activity}$, as we can see with a simple simulation:

> set.seed(16)
> N <- 100
> Lesion <- rnorm(N, 10, 2)
> Hypochondria <- rnorm(N, 10, 2)
> Test <- Lesion + Hypochondria + rnorm(N)
> Activity <- Hypochondria + rnorm(N)
> Cancer <- Lesion + 0.25 * Activity + rnorm(N)

where we hypothesize a much smaller effect of Activity on Cancer than Lesion on Cancer

> summary(lm(Cancer ~ Activity))

    Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 10.47570    1.01150  10.357   <2e-16 ***
Activity     0.21103    0.09667   2.183   0.0314 *  

And indeed we obtain a reasonable estimate.

Now, also observe the association of Activity and Cancer with Test (due to their common, but unmeasured causes:

> cor(Test, Activity); cor(Test, Cancer)
[1] 0.6245565
[1] 0.7200811

The traditional definition of confounding is that a confounder is variable that is associated with both the exposure and the outcome. So, we might mistakenly think that Test is a confounder and condition on it. However, we then open up the backdoor path $\text{Cancer}\leftarrow \text{Lesion} \rightarrow \text{Test} \leftarrow \text{Hypochondria} \rightarrow \text{Activity}$, and introduce confounding which would otherwise not be present, as we can see from:

> summary(lm(Cancer ~ Activity + Test))

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.77204    0.98383   1.801   0.0748 .  
Activity    -0.37663    0.07971  -4.725 7.78e-06 ***
Test         0.72716    0.06160  11.804  < 2e-16 ***

Now not only is the estimate for Activity biased, but it is of larger magnitude and of the opposite sign !

  • Selection bias

The preceding example can also be used to demonstrate selection bias. A researcher may identify Test as a potential confounder, and then only conduct the analysis on those that have tested negative (or positive).

> dtPos <- data.frame(Lesion, Hypochondria, Test, Activity, Cancer)
> dtNeg <- dtPos[dtPos$Test < 22, ]
> dtPos <- dtPos[dtPos$Test >= 22, ]
> summary(lm(Cancer ~ Activity, data = dtPos))

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 13.15915    3.07604   4.278 0.000242 ***
Activity     0.08662    0.25074   0.345 0.732637 

So for those that test positive we obtain a very small positive effect, that is not statistically significnt at the 5% level

> summary(lm(Cancer ~ Activity, data = dtNeg))

    Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 12.18865    1.12071  10.876   <2e-16 ***
Activity    -0.01553    0.11541  -0.135    0.893  

And for those that test negative we obtain a very small negative association which is also not significant.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ I think the arrow directions got messed up on the DAG you used to illustrate colliders; your writing treats X5 as if X4 and X6 were pointing at it, whereas the DAG has a X4->X5->X6 chain instead. $\endgroup$ – jkm Jan 20 at 12:31
  • 1
    $\begingroup$ @Alexis, I do not disagree. Thank you, I think I will add this to my answer together with something to make even more clear that there is no "one true DAG" (a common source of confusion among students, I have found) $\endgroup$ – Robert Long Jan 20 at 17:31
  • 2
    $\begingroup$ Great answer! Specially the R simulatons, it makes it super easy to understand. $\endgroup$ – cimentadaj Jan 21 at 8:11
  • 1
    $\begingroup$ @cimentadaj thank you. Indeed, simulations are a great way to understand things like this ! $\endgroup$ – Robert Long Jan 21 at 11:43
  • 2
    $\begingroup$ @PSellaz That qustion has already been asked and answered! Please see Representing interaction effects in directed acyclic graphs. $\endgroup$ – Alexis Jan 24 at 1:33
10
$\begingroup$

This is generally a fairly elaborate topic, and may require more reading on your part for better understanding, but I will try to answer a couple of your questions in isolation and leave references for further reading.

Confounding

Consider the example below:

enter image description here

Controlling for the confounding variable "Gender" gives us more information about the relationship between the two variables "Drug" and "Recovery". You can, for example, control for the confounder Z as a covariate (by conditioning) in regression analysis, and this will reduce your bias – as you know more about the effect of X on Y.

Colliding

As mentioned here, conditioning on a collider can actually increase bias. Consider the example below

Influenza / Chicken Pox on Fever

If I know you have a fever and don't have the flu, but I control for the colliding effect between Influenza and Chicken Pox knowing you have a fever actually gives me more evidence that you might have Chicken Pox (I recommend you read more about this, the link above should be useful).

Mediation

Controlling for intermediate variables may also induce bias, because it decomposes the total effect of x on y into its parts. In the example below, if you condition on the intermediate variables "Unhealthy Lifestyle", "Weight", and "Cholesterol" in your analysis, you are only measuring the effect of "Smoking" on "Cardiac Arrest", and not through the intermediate path, which would induce bias. In general, it depends on your research question when you want to control for an intermediate path or not, but you should know it can induce bias, and not reduce it.

enter image description here

Backdoor Path

Backdoor paths generally indicate common causes of A and Y, the simplest of which is the confounding situation below. You may want to look at the backdoor criterion [Pearl, 2000] to see whether eliminating the confounding variable is reasonable for a particular case.

enter image description here

Regularization

I also wanted to mention that the algorithms for statistical learning on DAGs reduce bias through regularization, see (this) for an overview. When learning on DAGS you can end up with highly complex relationships between covariates which can result in bias. This can be reduced by regularizing the complexity of the graph, as in [Murphy, 2012, 26.7.1].

Hope this provides you with enough to chew on for now..

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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