tests/testthat/setup.R

## Shared fixtures across the test suite. Loaded automatically by testthat.

data(synth.data, package = "Synth", envir = environment())

# A canonical dataprep object — matches s1_toy_panel from
# dev/01_capture_baseline.R so changes here are caught by the regression
# script as well.
make_dataprep <- function() {
  dataprep(
    foo = synth.data,
    predictors = c("X1", "X2", "X3"),
    predictors.op = "mean",
    dependent = "Y",
    unit.variable = "unit.num",
    time.variable = "year",
    special.predictors = list(
      list("Y", 1991, "mean"),
      list("Y", 1985, "mean"),
      list("Y", 1980, "mean")
    ),
    treatment.identifier = 7,
    controls.identifier = c(29, 2, 13, 17, 32, 38),
    time.predictors.prior = c(1984:1989),
    time.optimize.ssr = c(1984:1990),
    unit.names.variable = "name",
    time.plot = 1984:1996
  )
}

Try the Synth package in your browser

Any scripts or data that you put into this service are public.

Synth documentation built on April 29, 2026, 9:06 a.m.