View source: R/plot.placebos.R
plot_placebos | R Documentation |
Creates plots with the difference between observed units and synthetic controls for the treated and control units. See Abadie, Diamond, and Hainmueller (2011).
plot_placebos( tdf = tdf, discard.extreme = FALSE, mspe.limit = 20, xlab = NULL, ylab = NULL, title = NULL, alpha.placebos = 1, ... )
tdf |
An object with a list of outcome values for placebos,
constructed by |
discard.extreme |
Logical. Whether or not units with high pre-treatement
MSPE should be excluded from the plot. Takes a default of |
mspe.limit |
Numerical. Used if |
xlab |
Character. Optional. Label of the x axis. |
ylab |
Character. Optional. Label of the y axis. |
title |
Character. Optional. Title of the plot. |
alpha.placebos |
the transparency setting, default of |
... |
optional arguments (currently not used) |
generate.placebos
, gaps.plot
,
synth
, dataprep
## Not run: ## 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, strategy='multicore') ## Plot the gaps in outcome values over time of each unit -- ## treated and placebos -- to their synthetic controls p <- plot_placebos(tdf,discard.extreme=TRUE, mspe.limit=10, xlab='Year') p ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.