scplotMulti {scpi} | R Documentation |
Plot Synthetic Control Point Estimates and Prediction Interval With Multiple Treated units and Staggered Adoption
Description
The command produces a wide range of plots of Synthetic Control estimates and corresponding prediction intervals. The command allows form multiple treated units and staggered adoption.
Prediction intervals can take into account either in-sample uncertainty only or in-sample and
out-of-sample uncertainty using the techniques developed in Cattaneo, Feng, and Titiunik (2021). scpi
.
The input object should come from the command scest
or from the command scpi
.
Companion Stata and Python packages are described in Cattaneo, Feng, Palomba, and Titiunik (2022).
Companion commands are: scdata and scdataMulti for data preparation in the single and multiple treated unit(s) cases, respectively, scest for point estimation, scpi for inference procedures, and scplotMulti for plots with multiple treated units.
Related Stata, R, and Python packages useful for inference in SC designs are described in the following website:
https://nppackages.github.io/scpi/
For an introduction to synthetic control methods, see Abadie (2021) and references therein.
Usage
scplotMulti(
result,
type = "series",
e.out = TRUE,
joint = FALSE,
col.treated = "black",
col.synth = "mediumblue",
scales = "fixed",
point.size = 1.5,
ncols = 3,
save.data = NULL,
verbose = TRUE
)
Arguments
result |
a class 'scest' object, obtained by calling |
type |
a character that specifies the type of plot to be produced. If set to 'treatment' then treatment effects are plotted. If set to 'series' (default), the actual and synthetic time series are reported. |
e.out |
a logical specifying whether out-of-sample uncertainty should be included in the plot(s). |
joint |
a logical specifying whether simultaneous prediction intervals should be included in the plot(s). It requires |
col.treated |
a string specifying the color for the treated unit series. Find the full list at http://sape.inf.usi.ch/quick-reference/ggplot2/colour. |
col.synth |
a string specifying the color for the synthetic unit series. Find the full list at http://sape.inf.usi.ch/quick-reference/ggplot2/colour. |
scales |
should axes scales be fixed ("fixed", the default), free ("free"), or free in one dimension ("free_x", "free_y")? |
point.size |
a scalar controlling the size of points in the scatter plot. Default is 1.5. |
ncols |
an integer controlling the number of columns in the plot. |
save.data |
a character specifying the name and the path of the saved dataframe containing the processed data used to produce the plot. |
verbose |
if |
Value
plots |
a list containing standard ggplot object(s) that can be used for further customization. |
Author(s)
Matias Cattaneo, Princeton University. cattaneo@princeton.edu.
Yingjie Feng, Tsinghua University. fengyj@sem.tsinghua.edu.cn.
Filippo Palomba, Princeton University (maintainer). fpalomba@princeton.edu.
Rocio Titiunik, Princeton University. titiunik@princeton.edu.
References
Abadie, A. (2021). Using synthetic controls: Feasibility, data requirements, and methodological aspects. Journal of Economic Literature, 59(2), 391-425.
Cattaneo, M. D., Feng, Y., and Titiunik, R. (2021). Prediction intervals for synthetic control methods. Journal of the American Statistical Association, 116(536), 1865-1880.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022), scpi: Uncertainty Quantification for Synthetic Control Methods, arXiv:2202.05984.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). Uncertainty Quantification in Synthetic Controls with Staggered Treatment Adoption, arXiv:2210.05026.
See Also
scdata
, scdataMulti
, scest
, scpi
, scplotMulti
Examples
datager <- scpi_germany
datager$tr_id <- 0
datager$tr_id[(datager$country == "West Germany" & datager$year > 1990)] <- 1
datager$tr_id[(datager$country == "Italy" & datager$year > 1992)] <- 0
outcome.var <- "gdp"
id.var <- "country"
treatment.var <- "tr_id"
time.var <- "year"
df.unit <- scdataMulti(datager, id.var = id.var, outcome.var = outcome.var,
treatment.var = treatment.var,
time.var = time.var, features = list(c("gdp", "trade")),
cointegrated.data = TRUE, constant = TRUE)
res.unit <- scpi(df.unit, sims = 10, cores = 1)
scplotMulti(res.unit, joint = TRUE)