Week 6 - Good & Bad Controls

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: multi-collinearity, 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.

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

6-1. Use the Waffle House data, data(WaffleDivorce), to find the total causal influence of number of Waffle Houses on divorce rate. Justify your model or models with a causal graph (draw a DAG).

DAG <- dagitty("dag {
    A -> D
    A -> M -> D
    A <- S -> M
    S -> W -> D
  }")

coordinates(DAG) <- list(
  x = c(A = 1, S = 1, M = 2, W = 3, D = 3),
  y = c(A = 1, S = 3, M = 2, W = 3, D = 1)
)
drawdag(DAG)

adjustmentSets(DAG, exposure = "W", outcome = "D")
## { A, M }
## { S }
data(WaffleDivorce)
dataset <- WaffleDivorce

model <- quap(
  alist(
    Divorce ~ dnorm(mu, sigma),
    mu <- x + yS * South + yW * WaffleHouses,
    x ~ dnorm(0, 0.1),
    c(yS, yW) ~ dnorm(0, 0.6),
    sigma ~ dexp(1)
  ),
  data = dataset
)
precis(model)
##             mean         sd        5.5%      94.5%
## x     0.05940377 0.10025448 -0.10082226 0.21962980
## yS    0.30206359 0.59237851 -0.64467167 1.24879886
## yW    0.06283525 0.01581182  0.03756492 0.08810558
## sigma 7.95156136 0.72142316  6.79858782 9.10453490

6-2. Build a series of models to test the implied conditional independencies of the causal graph you used in the previous problem. If any of the tests fail, how do you think the graph needs to be amended? Does the graph need more or fewer arrows? Feel free to nominate variables that arenโ€™t in the data.

model <- quap(
  alist(
    Marriage ~ dnorm(mu, sigma),
    mu <- x + yS * South + yW * WaffleHouses,
    x ~ dnorm(0, 0.1),
    c(yS, yW) ~ dnorm(0, 0.6),
    sigma ~ dexp(1)
  ),
  data = dataset
)

precis(model)
##              mean         sd        5.5%      94.5%
## x      0.03158987 0.10005598 -0.12831891  0.1914987
## yS     0.15144445 0.59797348 -0.80423266  1.1071216
## yW     0.12292190 0.03115114  0.07313636  0.1727074
## sigma 15.94621529 1.31436847 13.84560062 18.0468300

6-3. Consider your own research question. Draw a DAG to represent it. What are the testable implications of your DAG? Are there any variables you could condition on to close all backdoor paths? Are there unobserved variables that you have omitted? Would a reasonable colleague imagine additional threats to causal inference that you have ignored?

#In my research I am trying to find out if Smoking causes heart attack or   if it raises Cholesterol which cause it

DAG <- dagitty("dag {
    Smoking -> Heart Attack
    Smoking -> Cholesterol -> Heart Attack}")

drawdag(DAG)

6-4. For the DAG you made in the previous problem, can you write a data generating simulation for it? Can you design one or more statistical models to produce causal estimates? If so, try to calculate interesting counterfactuals. If not, use the simulation to estimate the size of the bias you might expect. Under what conditions would you, for example, infer the opposite of a true causal effect?