# 3.2 — DAGs — Class Content

## Overview

Today we return to a more nuanced discussion of causality, given what we have learned about the fundamental problem of causal inference (counterfactuals and potential outcomes). RCTs are great, but they are not everything — and in any case, you are never going to be able to design and run an RCT in the overwhelming majority of studies.

Now that we understand counterfactuals, we can apply our idea of exogeneity to argue that indeed, yes, **correlation does imply causation** when \(X\) is exogenous! That is, \(X\) being correlated with \(Y\)

*implies*there is a causal connection between \(X\) and \(Y\), and if we are certain that \(cor(X,u)=0\), then we are clearly measuring the causal effect of \(X \rightarrow Y\)! If \(cor(X,u) \neq 0\) and \(X\) is endogenous, there is

*still*a causal connection between \(X\) and \(Y\), but it goes through other variables that jointly cause \(X\) and \(Y\).

We also introduce a new tool for thinking about simple causal models, the **directed acyclic graph (DAG)**. These are a hip new trend for thinking about causal inference, so new and trendy that they aren’t really in any mainstream textbooks yet!

DAGS and DAG rules (front doors, back doors, colliders, mediators, etc.) will allow you to visually map the causal relationships between variables and describe to you the variables you must **control for** in order to properly **identify the causal effect** you are trying to measure. I show you a simply tool, daggity.net that will help you do this, as well as `ggdag`

in `R`

.

## Readings

### Recommended Reading

#### On the Credibility Revolution in Econometrics

#### On DAGs

DAGs are a trendy new concept in econometrics and causal inference, so much so that they have yet to find their way into any major econometrics textbook! There are some resources, however, that you can look to for understanding how they work (and I base much of my lecture off of them).

- Ch. 3 in Cunningham (2020),
*Causal Inference, the Mixtape* - Chs. 6-9 in Huntington-Klein (2022),
*The Effect: An Introduction to Research Design and Causality* - Pearl and MacKenzie, (2018),
*The Book of Why* - Heiss (2020), Causal Inference”
- Huntington-Klein (2019), Dagitty.net Cheat Sheet”
- Huntington-Klein (2019), Causal Diagrams Cheat Sheet”
- My blog post on “Econometrics, Data Science, and Causal Inference”

The *best* book to get more into the philosophy of causality and the major origin of DAGs is Judea Pearl (and David McKenzie)’s *The Book of Why*. We owe much to Pearl, he is the flagship of the causal revolution (outside of econometrics).^{1} And his twitter is pretty amusing.

The best instantiation of DAGs and causal inference into a “textbook” on econometrics and methods is Scott Cunningham’s (open source!) *Causal Inference: The Mixtape* chapter on DAGs. Nick Huntington-Klein has some great lecture slides, and some cheat sheets on using Dagitty.net and understanding DAGs.

Andrew Heiss, a political science professor, has a great recent book chapter on causal inference using DAGs, complete with instructions on how to do it in R and dagitty.net.

Finally, I have a blog post discussing the difference between econometrics, causal inference, and data science. The end touches on causality, DAGs, and Pearl.

## Slides

Below, you can find the slides in two formats. Clicking the image will bring you to the html version of the slides in a new tab. The lower button will allow you to download a PDF version of the slides.

I suggest printing the slides beforehand and using them to take additional notes in class (*not everything* is in the slides)!

## Footnotes

He has an interesting and contentious relationship to economics.↩︎