Chapter 1 Introduction

This tutorial will introduce key concepts in machine learning-based causal inference. It’s an ongoing project and new chapters will be uploaded as we finish them. A tentative list of topics that will be covered:

  • Introduction to Machine Learning
  • Introduction to Causal Inference
  • Average Treatment Effects (Under construction)
  • Heterogeneous Treatment Effects (Under construction)
  • Policy Evaluation (Under construction)
  • Policy Leaning (Under construction)

Please note that this is currently a living document. If you find any issues with the code or broken links, feel free to contact Vitor Hadad at The “changelog” below will keep track of major updates and additions.

1.1 Getting started

We’ll illustrate key concepts using snippets of R code. Each chapter in this tutorial is self-contained. You can download its RMarkdown source by clicking on the link at the beginning of each chapter. You should be able to rerun most of the code on a different dataset by editing some of the common variables at the top of the notebook (e.g., data, covariates, and outcome). Exceptions to this rule are marked as comments in the text, so please read them carefully.

We try to restrict our package dependencies to a minimum, but at the moment you will at a minimum need to install the latest version of the following packages.

  • glmnet
  • grf
  • policytree
  • splines
  • lmtest
  • sandwich
  • causalTree

In addition, though not strictly necessary, we occasionally use additional packages for a more engaging visualization.

  • ggplot2
  • reshape2
  • knitr
  • kableExtra

1.2 Changelog

  • Apr 3rd, 2021. “Chapter 2: Introduction to Machine Learning” is up.
  • Apr 12th, 2021.
    • Fixed broken link to RMD source. Chapters now have a link at the beginning.
    • Introduction to ML: Added code to produce colored tables.
  • Apr 13th, 2021.
    • Additional links to RMD source.
    • Added chapter ATE-1.

1.3 Acknowledgments

This tutorial first started as an extension of documents written in part by research assistants, students, and postdocs at the Golub Capital Social Impact Lab. We thank the authors of those documents: Kaleb K. Javier, Niall Keleher, Sylvia Klosin, Nicolaj Søndergaard Mühlbach, Xinkun Nie, and Matt Schaelling.