Chapter 6 - The Haunted DAG & The Causal Terror

Multiple regression is no oracle, but only a golem. It is logical, but the relationships it describes are conditional associations, not causal influences. Therefore additional information, from outside the model, is needed to make sense of it. This chapter presented introductory examples of some common frustrations: multicollinearity, post-treatment bias, and collider bias. Solutions to these frustrations can be organized under a coherent framework in which hypothetical causal relations among variables are analyzed to cope with confounding. In all cases, causal models exist outside the statistical model and can be difficult to test. However, it is possible to reach valid causal inferences in the absence of experiments. This is good news, because we often cannot perform experiments, both for practical and ethical reasons.

Place each answer inside the code chunk (grey box). The code chunks should contain a text response or a code that completes/answers the question or activity requested. Make sure to include plots if the question requests them. Problems are labeled Easy (E), Medium (M), and Hard(H).

Finally, upon completion, name your final output .html file as: YourName_ANLY505-Year-Semester.html and publish the assignment to your R Pubs account and submit the link to Canvas. Each question is worth 5 points.

Questions

6E1. List three mechanisms by which multiple regression can produce false inferences about causal effects.

# Multicollinearity, Post-treatment bias and Collider bias.

6E2. For one of the mechanisms in the previous problem, provide an example of your choice, perhaps from your own research.

# Multicollinearity generally occurs when there are high correlations between two or more predictor variables.
# A person’s height and weight generally have high correlation and improper to be predictors together.

6E3. List the four elemental confounds. Can you explain the conditional dependencies of each?

# The Fork, X ← Z → Y where X and Y are independent, conditional on Z.
# The Pipe, X → Z → Y where X and Y are independent, conditional on Z.
# The Collider, X → Z ← Y. no association between X and Y unless you condition on Z
# The Descendant, conditioning on a descendent variable is like conditioning on the variable itself, but weaker.

6E4. How is a biased sample like conditioning on a collider? Think of the example at the open of the chapter.

# With a collider, an association is introduced between two variables when a third is added. A biased sample is like an un-measured collider. In the example that started the chapter, there was no association between trustworthiness and and newsworthiness. However, when selection status is added to the model, there appears to be a negative association. Now imagine that you only have data for the funded proposals. Here, there is an implicit conditioning on selection status, because you only have funded proposals. This is potentially more nefarious, because the collider isn’t explicitly in your data, or has no variance.

6M1. Modify the DAG on page 186 to include the variable V, an unobserved cause of C and Y: C ← V → Y. Reanalyze the DAG. Draw the DAG. How many paths connect X to Y? Which must be closed? Which variables should you condition on now?

# There are now 4 paths from X to Y. The two paths from the original DAG, and 2 new paths introduced by V.
# X <- U <- A -> C -> Y
# X <- U -> B <- C -> Y
# X <- U <- A -> C <- V -> Y
# X <- U -> B <- C <- V -> Y
# Paths 2 and 4 are already closed, because B is a collider. Paths 1 and 3 are open because A is a fork. In the original DAG, we could close either A or C; however, in the new DAG, C is a collider. Therefore, if we conditioned on C, we’d be opening up a new path through V. Therefore, if we want to make inferences about the causal effect of X on Y, we must only condition on A (assuming our DAG is correct).

6M2. Sometimes, in order to avoid multicollinearity, people inspect pairwise correlations among predictors before including them in a model. This is a bad procedure, because what matters is the conditional association, not the association before the variables are included in the model. To highlight this, consider the DAG X → Z → Y. Simulate data from this DAG so that the correlation between X and Z is very large. Then include both in a model prediction Y. Do you observe any multicollinearity? Why or why not? What is different from the legs example in the chapter?

library(dplyr)
#library(devtools)
library(rethinking)
N<-5000
X<-N %>% rnorm(mean=0,sd=1)
Z<-N %>% rnorm(mean=X,sd=0.5)
Y<-N %>% rnorm(mean=Z,sd=1)
cor(X,Z) %>% print
## [1] 0.8952695
# The variables  and  are highly correlated. We can check with a regression model for this.

m6m2<-quap(
  alist(
    Y ~ dnorm(mu,sigma),
    mu<-a+bX*X+bZ*Z,
    c(a,bX,bZ)~dnorm(0,1),
    sigma~dexp(1)
  ), data=list(X=X,Y=Y,Z=Z)
)

# The regression fit is essentially.
m6m2 %>% precis
##               mean         sd        5.5%      94.5%
## a     -0.010587718 0.01422047 -0.03331477 0.01213933
## bX     0.001513937 0.03197816 -0.04959335 0.05262122
## bZ     1.009649882 0.02886421  0.96351930 1.05578047
## sigma  1.005177173 0.01005020  0.98911501 1.02123934
#The fit shows how  is not a useful variable, due to the addition of , which is a post-treatment variable, and thus should not have been included. In effect, we also realize from this that multicollinearity is a data-driven property, and has no interpretation outside specific model instances.