3.2 — Causal Inference & DAGs — Class Content

Thursday, October 21, 2021

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

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).

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. Note while in going through the slides, you can type h to see a special list of viewing options, and type o for an outline view of all the slides.

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)!

3.2-slides

Download as PDF

New Packages Mentioned

  • dagitty.net: not a package in R, but an online tool to help you work with DAGs (see the cheat sheets in today’s readings page)

  • ggdag: for drawing DAGs in ggplot, and for identifying pathways ggdag_paths() and required adjustments ggdag_adjustment_set()

R Practice

See today’s practice problems to help you use DAGs and daggity.net. Answers will be posted on that page.


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

Previous
Next