scplotMulti: Plot Synthetic Control Point Estimates and Prediction...

View source: R/scplotMulti.R

scplotMultiR 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 scest, or a class 'scpi' object, obtained by calling scpi. The data object given as input to this command has to be processed with scdataMulti.

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 e.out = TRUE.

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 TRUE prints additional information in the console.

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

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)


scpi documentation built on Nov. 2, 2023, 5:41 p.m.