| plot.scm_placebo | R Documentation |
Visualizes the placebo study returned by mspe_ratio_pval(), following
Abadie, Diamond & Hainmueller (2010, Section 3.4).
## S3 method for class 'scm_placebo'
plot(
x,
type = c("gaps", "ratios"),
mspe_prune = Inf,
colors = NULL,
labels = NULL,
linetypes = NULL,
vline = list(),
vline_offset = 0,
hline = list(),
...
)
x |
A |
type |
One of |
mspe_prune |
Only for |
colors |
A named vector overriding series colors, e.g.
|
labels |
A named vector overriding the legend text of individual
series, e.g. |
linetypes |
Only for |
vline |
Only for |
vline_offset |
Only for |
hline |
Only for |
... |
Ignored. |
type = "gaps" overlays the treated unit's gap path (treated minus
synthetic control) on the placebo gap paths obtained by reassigning the
intervention to each donor unit (ADH 2010, Figure 4). Placebo units whose
synthetic control fits poorly before treatment carry no information about
the rarity of a large post-treatment gap, so ADH exclude units whose
pre-treatment MSPE exceeds a multiple of the treated unit's: 20, 5, and 2
in their Figures 5-7 (mspe_prune).
type = "ratios" shows the post/pre-treatment MSPE ratio of every unit
(ADH 2010, Figure 8), the statistic behind the two-sided permutation
p-value; it requires no pruning cutoff by construction.
A ggplot2 plot object.
mspe_ratio_pval()
set.seed(1)
panel <- expand.grid(unit = 1:10, year = 1:20)
panel$treated <- as.integer(panel$unit == 5 & panel$year > 15)
panel$gdp <- panel$unit + 0.5 * panel$year +
rnorm(nrow(panel)) + 3 * panel$treated
fit <- scm_fit(gdp ~ treated | unit + year, data = panel, method = "scm")
placebo <- mspe_ratio_pval(fit)
# Treated gap overlaid on the donor-pool placebo gaps (ADH 2010, Fig. 4)
plot(placebo, type = "gaps")
# Prune poorly fitting placebos and relabel the legend
plot(placebo, type = "gaps", mspe_prune = 5,
labels = c(treated = "Unit 5"))
# Set the line type of the placebo paths off against the treated one
plot(placebo, type = "gaps", linetypes = c(placebo = "dotted"))
# Move the treatment line one period earlier
plot(placebo, type = "gaps", vline_offset = -1)
# Post/pre-treatment MSPE ratios (ADH 2010, Fig. 8)
plot(placebo, type = "ratios")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.