Lectures on Causal Panel Analysis

Yiqing Xu, Stanford University

Slides for six lectures of 100 to 120 minutes each on causal inference with panel data. The lectures are for applied researchers and graduate students in the social sciences who work with panel data. Each method is introduced through an example and a picture, and formulas appear only where the ideas need them.

# Lecture Slides Source
1 The Parametric Approach 52 pp code
2 Difference-in-Differences 47 pp code
3 Factorial Difference-in-Differences 39 pp code
4 Two-Way Fixed Effects Revisited 33 pp code
5 Modern DID 48 pp code
6 Synthetic Control and Extensions 56 pp code

The page counts link to the PDFs, which have one page per slide. To present with the step-by-step reveals, build that version from the LaTeX source (make animated). “Code” opens the lecture’s folder on GitHub: the LaTeX source, the figures, and the R scripts that draw them.

The arc

Lectures 1 and 2 cover the parametric panel toolkit and the canonical difference-in-differences design. Lecture 3 extends that design to events that affect everyone (factorial difference-in-differences). Lecture 4 diagnoses three problems with two-way fixed effects: the design problem (what strict exogeneity implies for treatment assignment), violations of parallel trends, and the weighting problem when effects differ across units. Lecture 5 repairs the weighting problem with estimators that allow effects to differ, and works through three applications from a large reanalysis study. Lecture 6 turns to synthetic control, factor models, and doubly and triply robust estimators, which handle some violations of parallel trends.

The field is moving fast, and these slides lean toward the author’s own research and understanding of it. Read them as one path through the material rather than as a survey.

Software

The R packages used in the lectures, with tutorials:

  • fect: fixed effects counterfactual estimators.
  • gsynth: the generalized synthetic control method.
  • fdid: factorial difference-in-differences.
  • panelView: visualizing panel data.