Plots the event-time coefficients of eventstudy() with pointwise
confidence intervals, in the styles of plot.panglm_attgt() (see its
Styles section). The omitted reference period (zero by construction)
is drawn as an open symbol at zero, without an interval. With
bin = TRUE the end points pool all earlier (later) event times.
Arguments
- x
a
"panglm_eventstudy"object fromeventstudy()- min_e, max_e
event window to plot
- xlab, ylab, main
axis labels and title
- ylim
y-axis limits
- legend
logical: add a compact legend of the symbols
- style
"classic"(default),"points"or"line"(see Styles); for the event-time, cohort and calendar plots- ref
event time of the reference period, marked when its estimate is exactly zero; the default is the period omitted by
eventstudy()(x$ref)- onset
position of the dashed treatment-onset line on the event time axis:
NULLgives0forstyle = "classic"and-0.5(between the last pre-treatment and the first treated period) otherwise- onset_label
text written above the onset line; the default (
NA) is "Intervention" forstyle = "classic"and none otherwise,NULLsuppresses it- caps
logical: draw caps on the confidence-interval whiskers; the default (
NULL) draws them forstyle = "classic"only- ...
passed to
graphics::plot()
See also
Other eventstudy methods:
eventstudy-methods
Examples
set.seed(1)
d <- expand.grid(id = 1:100, year = 2015:2020)
d$first <- ifelse(d$id <= 50, 2018, NA)
e <- d$year - d$first
d$visits <- 3 + rnorm(100)[d$id] + ifelse(!is.na(e) & e >= 0, 1, 0) +
rnorm(nrow(d))
es <- eventstudy(visits ~ 1, data = d, index = c("id", "year"),
treat = "first", leads = 3, lags = 2)
plot(es, main = "Effect of the policy by event time")
plot(es, min_e = -2, legend = TRUE)
plot(es, style = "points")
plot(es, style = "line")