Skip to contents

R-CMD-check

fastdid implements the Difference-in-Differences (DiD) estimators in Callaway and Sant’Anna’s (2021). fastdid is

Getting Started

fastdid can be installed from GitHub.

# install.packages("devtools")
devtools::install_github("TsaiLintung/fastdid")

To use fastdid, you need to provide the dataset data, the column name of time timevar, cohort cohortvar, unit unitvar, and outcome(s) outcomevar. Here is a simple call:

library(fastdid) #loading the package
did_sim <- sim_did(1e+03, 10) #simulate some data
did_estimate <- fastdid(data = did_sim$dt, timevar = "time",
                  cohortvar = "G", unitvar = "unit", outcomevar = "y")

The function returns a data.table that includes the estimates. Column att is the point estimate, se the standard error of the estimate, att_ciub and att_cilb the confidence interval. The other columns indexes the estimated parameter.

To create event study plots, use plot_did_dynamics(did_estimate).

More

  • did: staggered Difference in Difference by Callaway and Sant’Anna
  • fastdid: full list of arguments and features.
  • double: introduction to DiD with multiple events.
  • misc: comparison with did, benchmark, tests, and experimental features.

Acknowledgments

fastdid is created and maintained by Lin-Tung Tsai. Many thanks to Maxwell Kellogg and Kuan-Ju Tseng for their contribution.