View source: R/generate.placebos.R
generate.placebos | R Documentation |
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).
generate.placebos(
dataprep.out,
synth.out,
Sigf.ipop = 5,
strategy = "sequential"
)
generate_placebos(
dataprep.out,
synth.out,
Sigf.ipop = 5,
strategy = "sequential"
)
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 |
Data frame with outcome data for each control unit and their respective synthetic control and for the original treated and its control
Mean squared prediction error for the pretreatment period for each placebo
First time unit in time.optimize.ssr
First time unit after the highest value in time.optimize.ssr
Unit number of the treated unit
Dataframe with two columns showing all unit numbers and names from control units
Number of control units
Unit name of the treated unit
Pretreatment MSPE of the treated unit's synthetic control
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.