Module 2: Causality and DAGs

Econometrics II

Department of Economics, WU Vienna

Ines Kusmenko (ines.kusmenko@wu.ac.at)

Department of Economics, WU Vienna

 

 

 

Causality

Identification

Experiments

Directed Acyclical Graphs

Causality

In this course, we are going to learn about causality.

  • When we say “causality”, we mean that some cause causes an effect on some outcome.
  • The cause is partly responsible for the effect on the outcome, and the effect on the outcome partly depends on the cause.
  • Causality is not something we can determine using some sort of statistical test. We need additional assumptions in order to come up with a research design that allows us to answer causal questions.
  • The credibility of our causal analysis will depend on how defensible our assumptions are.

Is This Causal?

Image by Kiran891 (2023)

  • We know that there is a correlation between rain and puddles, but also between (much rarer) fire hydrant failures and puddles.
  • Can we say that the fire hydrant failure caused this puddle?
  • Yes, because we have an understanding of physics and see the water falling onto the grass.
  • In econometrics terms, we observe \(\text{Hydrant Failure}_{\text{place}}=1\) and \(\text{Puddle}_{\text{place}}=1\). This is not enough to infer causality, we need additional assumptions (here, physics).

The Fundamental Problem of Causal Inference

Remember that in the potential outcomes framework (more precisely: in the Neyman-Rubin Causal Model), the causal effect of a treatment \(X\) on an outcome \(Y\) is (for a binary treatment):

\[ \text{Causal Effect}_i=\textcolor{var(--secondary-color)}{Y_i}(\textcolor{var(--primary-color)}{1})-\textcolor{var(--secondary-color)}{Y_i}(\textcolor{var(--primary-color)}{0}) \]

In reality, only one outcome is realized, the other is counterfactual. We have to estimate this missing outcome to learn about the causal effect.

i \(X_i\) \(Y_i\) \(Y_i(1)\) \(Y_i(0)\)
1 0 1 ? 1
2 0 1 ? 1
3 1 1 1 ?
4 1 0 0 ?
…
N 1 1 1 ?

 

 

Causality

Identification

Experiments

Directed Acyclical Graphs

Application: DAGs in Research

Identification

We say an effect is causally identified if we can interpret it causally in our framework and scope. Can we identify a causal effect of studying and income using data only on the two?

Identification

Can we identify a causal effect using the following model?

\[ \text{income}_i = \text{hours studied}_i\:\beta + u_i \]

  • No. Why?
    • We do not get paid for having studied, but we do get paid more if we have better skills.
    • Our skills are affected by studying, but they are also affected by other things, such as our talent.
    • At the same time, talent affects how much we study, and may also affect income directly.
    • We have no way to identify what part of all of this is caused by studying.

Causal Quantities

In addition to the individual causal effect, which we can never find nor estimate, there are the following quantities:

The Average Treatment Effect (ATE) is the mean of all individual treatment effects. \[ \begin{aligned} \mathrm{ATE} = \mathrm{E}(\text{Causal Effect}_i) &= \mathrm{E}(Y_i(1)-Y_i(0))\\ &= \mathrm{E}(Y_i(1))- \mathrm{E}(Y_i(0)). \end{aligned} \]

The Conditional Average Treatment Effect (CATE) is conditional on some third characteristic \(Z_i\): \[ \mathrm{CATE} = \mathrm{E}(\text{Causal Effect}_i| Z_i = z) \]

The Average Treatment Effect on the Treated (ATT) is the treatment effect for only the subset of the population that was treated.

\[ \mathrm{ATT} = \mathrm{E}(\text{Causal Effect}_i| X_i = 1) \]

Estimating the Average Treatment Effect

\(i\) \(X_i\) \(Y_i\) \(Y_i(1)\) \(Y_i(0)\)
\(1\) \(0\) \(1\) \(-\) \(1\)
\(2\) \(0\) \(0\) \(-\) \(0\)
\(3\) \(0\) \(0\) \(-\) \(0\)
\(4\) \(0\) \(0\) \(-\) \(0\)
\(5\) \(1\) \(1\) \(1\) \(-\)
\(6\) \(1\) \(1\) \(1\) \(-\)
\(7\) \(1\) \(1\) \(1\) \(-\)
\(8\) \(1\) \(0\) \(0\) \(-\)
  • Note that \[ \begin{aligned} &\mathrm{E}(Y_i(0)) = 0.25,\\ &\mathrm{E}(Y_i(1)) = 0.75. \end{aligned} \]
  • Thus, \[ \begin{aligned} \mathrm{ATE} = &\mathrm{E}(Y(1))- \\ &\mathrm{E}(Y(0)) = 0.5 \end{aligned} \]
  • We can also simply estimate the ATE by running the following OLS regression: \[ \boldsymbol{y}= \boldsymbol{x}'\beta + \boldsymbol{u}, \] where \(\beta\) corresponds to the ATE.

Ignorability

A treatment \(X\) is ignorable if both potential outcomes are independent of \(X\), the treatment: \[ (Y(1),Y(0))\perp\!\!\!\!\perp X \]

\(X\) is ignorable when the treatment is randomly assigned and only affects the outcome \(Y\) by either realizing \(Y(0)\) or \(Y(1)\): \[ Y = Y(1)\times X + Y(0)\times (1-X) \]

Think

When is treatment assignment not ignorable?

Conditional Ignorability

A treatment \(X\) is ignorable conditional on covariates \(Z\) if:

  1. \((Y(1),Y(0))\perp\!\!\!\!\perp X|Z\), and
  2. \(\operatorname{P}(X=1) \in (0,1)\)

That is, potential outcomes are independent of \(X\), conditional on \(Z\), and there are both treated and untreated subjects.

If \(X\) is ignorable, we can use the sample averages \(\mathrm{E}(Y_i(0))\) and \(\mathrm{E}(Y_i(1))\) as estimates for \(Y(0)\) and \(Y(1)\). This means that the estimate of the \(\mathrm{ATE}\) will be causally identified.

We can identify a causal effect if we travel to a different reality and compare realized to counterfactual outcomes,

or we can find a setting in which treatment is ignorable to identify the causal effect, which is much easier to do.

 

Causality

Identification

Experiments

Directed Acyclical Graphs

Application: DAGs in Research

 

Randomized Experiments

How do we get treatment to be ignorable?

Experiments, either natural or designed experiments, are the gold standard. Treatment is truly randomly assigned, and we can identify a causal effect without any fancy econometrics.

Experiments are not always feasible. Thankfully, there are other ways to identify a causal effect (i.e., to ensure ignorability of treatment). We are going to spend much of the semester discussing those.

Think

What can prevent us from conducting an experiment? And even if there is nothing preventing us from doing so, are there reasons not to conduct one?

Imbalance

Even with randomization, imbalance and overlap can threaten causal identification.

  • An imbalance between treated and control groups occurs when there are differences between the groups.
  • In large samples, these imbalances disappear, but if our sample is small, we may want to account for them.
  • Even if means are similar, distributions can be different.

Overlap

  • Overlap describes how similar the range of the data is across groups.
  • Lacking overlap means that there are parts of one group that have characteristics that no one in the other group has.
  • This means that we have to extrapolate beyond the support of the data.

Blocked Experiment

When designing an experiment, we can use prior information to get more precise and accurate estimates. Imagine an experiment where we test the efficacy of a medical drug.

We know that age is an important covariate that governs how people respond to a drug, and probably also affects the treated disease directly. To minimize balance and overlap issues, we can run a blocked experiment:

  1. Divide all participants into multiple blocks based on their age.
  2. We end up with blocks in which subjects have similar ages.
  3. Randomize treatment within each block.

We can calculate an ATE separately for each block. If we are interested in an overall ATE, we can subsequently compute a weighted average of the block-specific ATEs (weighted by the number of observations for each block.).

Blocked Experiment: Visualization

Causality

Identification

Experiments

Directed Acyclical Graphs

Application: DAGs in Research

 

 

Ways of Viewing Causal Questions

The Potential Outcomes (PO) framework, which we covered last week, is one way to view causal questions.

  • There is a treatment \(X_i\) that takes on different values for each unit.
  • For each possible level of treatment, there is a certain potential outcome \(Y(x)\).
  • Only one potential outcome is observed, the others are counterfactuals.

The potential outcomes framework relates very clearly to the notion of a randomized experiment.

Today, we are discussing a different framework that has its strengths elsewhere: the Directed Acyclical Graphs (DAG) framework.

  • It is a graphical framework that helps us identify a causal effect in a network of variables.
  • It has its strengths in a world with a large number of (observed) variables, and
  • may help people who prefer thinking graphically to understand causal questions.

A Glorified Flowchart?

To give you an intuition before we start with the theory, a DAG looks like this:

  • They are similar in concept to flowcharts, but they are not the same.
  • You might occasionally have seen them in informal use, e.g. in Econometrics I.
  • In this example, the arrow represents a causal effect from \(\text{cause}\) on \(\text{effect}\).

A Short Intro to Graph Theory

What you see on the right is what we call a graph.

This graph has three nodes. They are labeled \(i\), \(j\), and \(k\). Sometimes, we call the nodes “vertices,” “agents,” “points,” etc.

Some of the nodes in a graph are usually connected to each other, while others are not. We call those connections edges. Alternatively, they can be called “links,” “connections,” “lines,” etc.

Edges are pairs of two nodes. In the second graph, there is one edge from \(i\) to \(j\). We call this edge \(\{i,j\}\).

A Short Intro to Graph Theory

This edge does not have a direction.

However, we can easily give edges a direction. We call an edge like this a directed edge. When an edge is directed, the corresponding pair of nodes is no longer an unordered pair, but an ordered pair: \(\{j,i\}\neq\{i,j\}\).

A walk is a sequence of edges that joins a sequence of nodes. A cycle is a special case of a walk where all edges are distinct and the initial and final node are equal. In this graph, \(\left\{\{a,b\},\{b,c\},\{c,a\}\right\}\) is a cycle.

Directed Graphs, Acyclic Graphs

A graph that does not contain any cycles is called an acyclic graph.

If a graph contains only directed edges, we call it a directed graph.

The following graph is both directed and acyclic. We therefore call it a

Directed Acyclic Graph (DAG).

Think

Why is \(\{\{A,B\},\{B,C\},\)\(\{C,E\},\{E,A\}\}\) not a cycle?

DAGs for Causal Modeling

Why do we talk about DAGs in an Econometrics class? Because they are really useful for causal modeling.

In the following DAG, nodes represent (random) variables, and edges represent (hypothesized) causal effects.

Missing edges also convey information: the assumption of no causal effect.

DAGs and Causal Inference

DAGs are a very useful framework for causal inference because

  • they visualize causal relationships between a number of variables,
    • which allows us to transparently state our assumptions,
  • and they help us identify a causal effect,
    • i.e., they tell us which variables to control for to estimate an effect.

The Basics of Causal Inference with DAGs

  • Is \(Y\) related to \(U\)?
  • Is \(X\) related to \(U\)? Can we randomize treatment?
  • Are there other important variables?

It turns out that there are two paths from \(X\) to \(Y\),

  • one direct path \(X \rightarrow Y\)
  • and one backdoor path \(X \leftarrow U \rightarrow Y\).

We call it a backdoor path because it enters \(X\) trough the “back door,” via an arrow pointed at \(X\).

Confounders

In this DAG, when we want to isolate the effect \(X\rightarrow Y\), there is one open backdoor path.

This path confounds the causal effect of interest. We therefore call the variable \(U\) a confounder.

Confounder

A confounder is a variable that influences both the dependent and the explanatory variables.

Confounders and Backdoors

If we just look at the connection between \(X\) and \(Y\), two effects are mixed together:

  • The effect of \(X\) on \(Y\), our effect of interest.
  • The effect of \(U\) on \(Y\) via \(X\).

We can close the backdoor by controlling for the confounder. We only run into problems when we cannot control for the confounder.

We would run a regression along the lines of:

\[ \boldsymbol{y} \sim \boldsymbol{x} + \boldsymbol{u}. \]

Colliders

Now imagine a different situation: There is a third variable, \(V\), that is jointly influenced by \(X\) and \(Y\).

Effects of both variables collide at \(V\). We therefore call \(V\) a collider. There is again one direct path and one backdoor path, but since the backdoor collides at \(V\), it is already closed.

Collider

A collider is a variable that is influenced by both the dependent and the explanatory variables.

Closing Backdoors

Open backdoors between two variables introduce systematic, non-causal correlation between them. If we want to estimate a causal effect, we need to close them. There are three cases we have to consider:

Confounders

We close backdoor paths by controlling for confounders.

Colliders

We can (and need to) leave colliders alone. The backdoor path is already closed.

Mediators

A mediator mediates part of the effect. If we control for the mediator, we remove the mediated effect and leave only the direct effect.

Identification

Experiments

Directed Acyclical Graphs

Application: DAGs in Research

 

 

 

Enumerating Paths

How does this framework look like if we apply it to an example? Let us look at the following graph on the effect of gender (\(F\)) based discrimination (\(X\)) on earnings (\(Y\)).

We account for occupation (\(O\)) and aptitude (\(A\)).

Note that aptitude is not observed.

How many paths from \(X\) to \(Y\) can we enumerate?

Enumerating Paths

How many paths between \(X\) and \(Y\) can we enumerate?

  1. \(X\rightarrow Y\),
  2. \(X \rightarrow O \rightarrow Y\),
  3. \(X \rightarrow O \leftarrow A \rightarrow Y\),
  4. \(X \leftarrow F \rightarrow O \rightarrow Y\),
  5. \(X \leftarrow F \rightarrow O \leftarrow A \rightarrow Y\).

Which models can we use to isolate the effect of interest?

  • \(Y \sim F\): We get a compound effect of \(X\) and \(O\) (1, 2, 4).
  • \(Y \sim X\): We get the effects of \(X\), but they are confounded by \(F\) (4).
  • \(Y \sim X, O\): We get rid of the confounder \(F\) and separate the effects of \(X\) (1, 2), but they are now confounded by \(A\) (3, 5).

Without \(A\), we cannot isolate the causal effect of \(X\) on \(Y\) in this model. DAGs can highlight what cannot be done.

Does Smoking During Pregnancy Protect Your Child?

  • The debate about whether smoking causes cancer was settled by the 1960s. Its conclusion had been delayed by multiple years because scientists disagreed on the meaning of “to cause,” and no ways of discerning causal effects from observational data were available.
  • But even afterwards, one paradox remained. Some researchers argued that smoking during pregnancy was actually good – if the unborn child was underweight.
  • The paradox was not resolved until 2006. Pearl & Mackenzie (2018) argue that it took so long because precise language of causality was not yet available.

Smoking Mothers

  • Underweight infants were found to have a death rate twenty times higher than normal-weight newborns.
  • Babies of smokers during pregnancy were on average 200 grams lighter than those of non-smokers.
  • However, underweight babies of smoking mothers had a higher survival rate than underweight babies of non-smoking mothers.

How come?

Smoking Mothers

  • Scientists at the time cautiously concluded that smoking may not affect the development of the fetus.
  • However, another explanation makes much more sense:
    • There are (thinking in a blatantly simplified way) two possible causes for a low birth weight: Smoking and having a birth defect.
    • If a mother does not smoke, a low birth weight points much more strongly to a birth defect.
    • Birth weight acts as a collider.
  • The original paradox becomes a (literal) textbook case of collider bias.

The Berkeley Admissions Paradox

  • In 1978, an associate dean at the University of California noticed that 44 percent of applying men were admitted, but only 35 percent of women.
  • Admission decisions were made by individual departments.
  • The university surveyed all departments, and found that in every department, admission decisions were more favorable to women than to men.

How is this possible?

The Berkeley Admissions Paradox

  • It turns out that the \(\text{gender}\rightarrow\text{outcome}\) relation has an important mediator.
  • Discrimination is a causal concept, and thus a causal graph can help understand the situation.
  • Women were applying to different departments/majors than men.
    • More women applied to humanities departments, which were harder to get into.
  • The choice of department is a mediator. Whether we want to condition on the mediator depends on the specific question we want to answer.
  • In this case, it depends on our understanding of discrimination as well as whether we ask about a societal phenomenon or whether the university is at fault.

Simpson’s Paradox

No Drug Took Drug
Heart Attack No Heart Attack Heart Attack No Heart Attack
Female 1 19 3 37
Male 12 28 8 12
Total 13 47 11 49
  • Assume a fictional doctor, Dr. Smith, reads about a drug that reduced the probability of a heart attack among the subjects that took the drug (no randomized trial).
  • However, both in men and in women, the drug seemed to increase the propensity to suffer from a heart attack.

How does this “Bad-Bad-Good (BBG)” drug paradox arise?

Simpson’s Paradox

No Drug Took Drug
Heart Attack No Heart Attack Heart Attack No Heart Attack
Female 1 19 3 37
Male 12 28 8 12
Total 13 47 11 49
  • Actually, the drug is just plain bad.
  • Since gender is a confounder and affects both the propensity to take a drug and the chance of a heart attack, we need to control for it when comparing totals.
  • In the example, we can do this by looking at both groups separately and then averaging. We find out that there is a negative effect for both women and men, and so the aggregate effect is also negative.

Summary Slide

  • All of the previous three examples are taken from “The Book of Why” by Pearl & Mackenzie (2018). You can read more about them, and about similar examples, in the book.
    • The smoking mothers paradox highlighted what can happen if we improperly treat colliders.
    • The Berkeley admissions paradox was a case of ignoring an important mediator
    • Smith’s Paradox was a case of ignoring a confounder.
  • DAGs are useful tools, particularly when using observational data, to visualize causal networks and make confounders, colliders, and mediators explicit.

References


Cunningham, S. (2021). Causal inference. Yale University Press. https://doi.org/10.12987/9780300255881
James, G., Witten, D., Hastie, T., & Tibshirani, R. (2021). An introduction to statistical learning. Springer US. https://doi.org/10.1007/978-1-0716-1418-1
Kiran891. (2023). Broken fire hydrant leak high-pressure water spout (2023, Vero Beach, Florida). https://commons.wikimedia.org/wiki/File:Broken_fire_hydrant_leak_high-pressure_water_spout_(2023,_Vero_Beach,_Florida)_01.jpg.
Pearl, J. (2009). Causality. In Cambridge Core. Cambridge University Press. https://doi.org/10.1017/CBO9780511803161
Pearl, J., & Mackenzie, D. (2018). The book of why: The new science of cause and effect. Basic books.