README (original) (raw)

synthReturn

The synthReturn R package implements the revised_Synthetic Matching Algorithm_ of Kreitmeir et al. (2025), building on the original approach of Acemoglu et al. (2016), to estimate the cumulative treatment effect_of an event on treated firms’ stock returns. For details on the_Synthetic Matching Algorithm and the available inference methods, see Section A.2 of the supplementary Online Appendix.

If you end up using this package, please cite the package and our paper:

Installation

To install the most recent version of the synthReturnpackage from GitHub:

# install.packages("devtools")
devtools::install_github("davidkreitmeir/synthReturn")

Short examples

The following is an illustration of the method for a simulated dataset with two event-dates.

library(synthReturn)
# Load data in that comes in the synthReturn package
data(ret_two_evdates)
  1. We run the synthetic matching algorithm with _permutation_inference.
set.seed(123) # set random seed

# Run synthReturn
res.placebo <- synthReturn(
  data = ret_two_evdates,
  unitname = "unit",
  treatname = "treat",
  dname = "date",
  rname = "ret",
  edname = "eventdate",
  estwind = c(-100,-1),
  eventwind = c(0,5),
  estobs_min = 1,
  eventobs_min = 1,
  inference = "permutation",
  correction = FALSE,
  ncontrol_min = 10,
  ndraws = 100,
  ncores = 1
)

# Print result table
print(res.placebo)
  1. We run the synthetic matching algorithm with a nonparametric bootstrap procedure to obtain uncertainty estimates.
set.seed(123) # set random seed

# Run synthReturn
res.boot <- synthReturn(
  data = ret_two_evdates,
  unitname = "unit",
  treatname = "treat",
  dname = "date",
  rname = "ret",
  edname = "eventdate",
  estwind = c(-100,-1),
  eventwind = c(0,5),
  estobs_min = 1,
  eventobs_min = 1,
  inference = "bootstrap",
  correction = FALSE,
  ncontrol_min = 10,
  ndraws = 100,
  ncores = 1
)

# Print result table
print(res.boot)
  1. We make use of the parallelization of synthRetrun by setting ncores = NULL. The defaultncores = NULL uses all available cores. In addition, we provide the option static_scheduling to set the scheduling type, where TRUE (default) implies static scheduling, andFALSE dynamic scheduling. Note that the scheduling choice has no effect when ncores = 1 and ininference = "permutation" estimations on Windows machines.
set.seed(123) # set random seed

# Run synthReturn
res.parallel <- synthReturn(
  data = ret_two_evdates,
  unitname = "unit",
  treatname = "treat",
  dname = "date",
  rname = "ret",
  edname = "eventdate",
  estwind = c(-100,-1),
  eventwind = c(0,5),
  estobs_min = 1,
  eventobs_min = 1,
  inference = "permutation",
  correction = FALSE,
  ncontrol_min = 10,
  ndraws = 100,
  ncores = NULL,
  static_scheduling = TRUE
)

# Print result table
print(res.parallel)