| plot.fdid | R Documentation |
Provides visualisations for FDID results, including raw means, dynamic
effects, and propensity-score overlap. The comparison plot of multiple
methods has been removed; use plot.fdid_list() for that.
## S3 method for class 'fdid'
plot(
x,
type = c("raw", "dynamic", "overlap"),
connected = FALSE,
ci = TRUE,
shade_periods = x$tr_period,
alpha_shade = 0.2,
palette = "Set2",
group_labels = c("Group 0", "Group 1"),
xlab = NULL,
ylab = NULL,
main = NULL,
ylim = NULL,
...
)
x |
An |
type |
One of |
connected |
Logical; if |
ci |
Logical; if |
shade_periods |
Shaded intervals on the time axis. Default uses |
alpha_shade |
Transparency for shading the treatment period. |
palette |
A palette name from RColorBrewer. Default |
group_labels |
Labels for the two groups. |
xlab, ylab, main |
Axis labels and main title. |
ylim |
Y-axis limits. Default |
... |
Additional graphics parameters. |
Produces a plot; invisibly returns NULL.
Rivka Lipkovitz, Enhan Liu
data(fdid)
mortality$uniqueid <- paste(mortality$provid, mortality$countyid, sep = "-")
mortality$G <- ifelse(mortality$pczupu >= median(mortality$pczupu, na.rm = TRUE), 1, 0)
s <- fdid_prepare(
data = mortality, Y_label = "mortality",
X_labels = c("avggrain", "lnpop"),
G_label = "G", unit_label = "uniqueid", time_label = "year"
)
result <- fdid(s, tr_period = 1958:1961, ref_period = 1957)
plot(result, type = "raw")
plot(result, type = "dynamic")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.