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

View source: R/scplot.R

scplotR Documentation

Plot Synthetic Control Point Estimates and Prediction Interval

Description

The command plots the actual pre-treatment and post-treatment series of the treated unit and the estimated counterfactual synthetic control unit with corresponding prediction intervals. 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

scplot(
  result,
  fig.path = NULL,
  fig.name = NULL,
  fig.format = "png",
  e.out = TRUE,
  joint = FALSE,
  col.treated = "black",
  col.synth = "mediumblue",
  label.xy = NULL,
  plot.range = NULL,
  x.ticks = NULL,
  event.label = NULL,
  plot.specs = NULL,
  save.data = NULL
)

Arguments

result

a class 'scest' object, obtained by calling scest, or a class 'scpi' object, obtained by calling scpi.

fig.path

a string indicating the path where the plot(s) should be saved.

fig.name

a string indicating the name of the plot(s). If multiple plots will be saved the command automatically generates a numeric suffix to avoid overwriting them.

fig.format

a string indicating the format in which the plot(s) should be saved.

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.

label.xy

a character list with two elements indicating the name of the axes (eg. label.xy = list(x.lab = "Year", y.lab = "GDP growth (%)")).

plot.range

a numeric array indicating the time range of the plot(s).

x.ticks

a numeric list containing the location of the ticks on the x axis.

event.label

a list containing a character object ('lab') indicating the label of the event and a numeric object indicating the height of the label in the plot.

plot.specs

a list containing some specifics to be passed to ggsave (eg. img.width, img.height, dpi)

save.data

a character specifying the name and the path of the saved dataframe containing the processed data used to produce the plot.

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


data <- scpi_germany

df <- scdata(df = data, id.var = "country", time.var = "year",
             outcome.var = "gdp", period.pre = (1960:1990),
             period.post = (1991:2003), unit.tr = "West Germany",
             unit.co = setdiff(unique(data$country), "West Germany"),
             constant = TRUE, cointegrated.data = TRUE)

result <- scest(df, w.constr = list(name = "simplex", Q = 1))

scplot(result)


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