Skip to contents

Plots the treatment-synthetic gap (treated outcome minus synthetic control outcome) over time for synthetic control methods, with optional in-space placebo gaps for statistical inference.

Usage

sc_gap_plot(
  treated_outcome,
  synthetic_outcome,
  time_periods,
  treatment_period,
  donor_gaps = NULL,
  placebo_alpha = 0.25,
  placebo_rmspe_filter = 2,
  ci_level = 0.9,
  title = "Synthetic Control: Gap Plot",
  unit_label = "Treated"
)

Arguments

treated_outcome

Numeric vector. Observed outcome for the treated unit over time.

synthetic_outcome

Numeric vector. Synthetic control outcome over time (same length as treated_outcome).

time_periods

Numeric vector. Time period labels (same length).

treatment_period

Numeric or integer. The first period of treatment (vertical line drawn here).

donor_gaps

List or matrix. Optional. Gaps for donor/placebo units (in-space placebos). Each column or list element should be a numeric vector of length length(time_periods).

placebo_alpha

Numeric. Transparency of placebo gap lines. Default 0.25.

placebo_rmspe_filter

Numeric. Exclude donor units whose pre-treatment RMSPE exceeds placebo_rmspe_filter times the treated unit's pre-treatment RMSPE. Default 2 (common in Abadie et al.).

ci_level

Numeric. If > 0, show a band at ± ci_level-th percentile of placebo gaps. Default 0.9.

title

Character. Plot title.

unit_label

Character. Label for the treated unit. Default "Treated".

Value

A ggplot2 object.

References

Abadie, A., Diamond, A., & Hainmueller, J. (2010). Synthetic control methods for comparative case studies: Estimating the effect of California's tobacco control program. Journal of the American Statistical Association, 105(490), 493–505.

Examples

if (FALSE) { # \dontrun{
library(Synth)
# After running synth(), extract gaps:
sc_gap_plot(
  treated_outcome   = Y_treated,
  synthetic_outcome = Y_synthetic,
  time_periods      = 1970:2000,
  treatment_period  = 1989
)
} # }