| 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 = NULL,
colors = NULL,
labels = NULL,
linetypes = NULL,
vline = list(),
vline_offset = .VLINE_OFFSET_DEFAULT,
hline = list(),
...
)
x |
A |
type |
One of |
mspe_prune |
Exclude placebo units whose
pre-treatment MSPE exceeds |
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 statistic behind the two-sided permutation
p-value, one point per unit (ADH 2010, Figure 8): the post/pre-treatment
MSPE ratio, or the post-treatment MSPE where the test was run with
statistic = "post_mspe". The ratio needs no pruning cutoff by
construction, which is why mspe_ratio_pval() leaves mspe_prune at
Inf; where the test did prune, the same runs are dropped here so that the
points and the p-value in the subtitle describe one set of placebo runs.
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 onto the first post-treatment period
plot(placebo, type = "gaps", vline_offset = 0)
# 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.