generate.placebos {SCtools} | R Documentation |
Function to generate placebo synthetic controls
Description
Constructs a synthetic control unit for each unit in the donor pool of an implementation of the synthetic control method for a single treated unit. Used for placebo tests (see plot_placebos, mspe.test, mspe.plot) to assess the strength and significance of a causal inference based on the synthetic control method. On placebo tests, see Abadie and Gardeazabal (2003), and Abadie, Diamond, and Hainmueller (2010, 2011, 2014).
Usage
generate.placebos(
dataprep.out,
synth.out,
Sigf.ipop = 5,
strategy = "sequential"
)
generate_placebos(
dataprep.out,
synth.out,
Sigf.ipop = 5,
strategy = "sequential"
)
Arguments
dataprep.out |
A data.prep object produced by the |
synth.out |
A synth.out object produced by the |
Sigf.ipop |
The Precision setting for the ipop optimization routine. Default of 5. |
strategy |
The processing method you wish to use
"sequential", "multicore" or "multisession". Use "multicore" or "multisession" to parallelize operations
and reduce computing time. Default is |
Value
- df
Data frame with outcome data for each control unit and their respective synthetic control and for the original treated and its control
- mspe.placs
Mean squared prediction error for the pretreatment period for each placebo
- t0
First time unit in
time.optimize.ssr
- t1
First time unit after the highest value in
time.optimize.ssr
- tr
Unit number of the treated unit
- names.and.numbers
Dataframe with two columns showing all unit numbers and names from control units
- n
Number of control units
- treated.name
Unit name of the treated unit
- loss.v
Pretreatment MSPE of the treated unit's synthetic control
Examples
## Example with toy data from Synth
library(Synth)
# Load the simulated data
data(synth.data)
# Execute dataprep to produce the necessary matrices for synth
dataprep.out<-
dataprep(
foo = synth.data,
predictors = c("X1"),
predictors.op = "mean",
dependent = "Y",
unit.variable = "unit.num",
time.variable = "year",
special.predictors = list(
list("Y", 1991, "mean")
),
treatment.identifier = 7,
controls.identifier = c(29, 2, 13, 17),
time.predictors.prior = c(1984:1989),
time.optimize.ssr = c(1984:1990),
unit.names.variable = "name",
time.plot = 1984:1996
)
# run the synth command to create the synthetic control
synth.out <- synth(dataprep.out, Sigf.ipop=2)
## run the generate.placebos command to reassign treatment status
## to each unit listed as control, one at a time, and generate their
## synthetic versions. Sigf.ipop = 2 for faster computing time.
## Increase to the default of 5 for better estimates.
tdf <- generate.placebos(dataprep.out,synth.out, Sigf.ipop = 2)