fdid – User Tutorial
Welcome
This Quarto book serves as a user tutorial for the fdid package in R, which implements the Factorial Difference-in-Differences (FDID) framework introduced by Xu, Zhao, and Ding (2026)[Paper]. This design is tailored for panel data settings where all units are exposed to a universal event but vary in a baseline factor \(G\) (currently supported as binary).
fdid provides two main functions:
fdid_prepare(): reshapes long format panel data into a widefdid()-ready format.fdid(): performs factorial difference-in-differences estimation using several methods.
And two S3 methods:
summary(): summarizes the estimation results.plot(): visualizes raw means, dynamic effects, and model comparisons.
Organization
The user tutorial is structured into the following chapters:
Chapter 1 Get Started
This chapter covers installation instructions and introduces the dataset.Chapter 2 FDID Main Program
This chapter explains how to prepare the dataset, perform factorial difference-in-differences estimation using several methods and plot the results.Chapter 3 Visualization Options
This chapter explores more various plotting options.
Contributors
- Rivka Lipkovitz (MIT)
- Enhan Liu (UChicago Harris)
- Yiqing Xu (Stanford)
Report bugs
Please report any bugs to me (yiqingxu [at] stanford.edu) or submit an issue on GitHub. Please include your minimally replicable code and data files and a panelView treatment status plot. Your feedback is highly valued!