Base plot() method for es_result objects returned by event_study()
(or the deprecated run_es()). Draws the event-study curve with pointwise
confidence bands as a static ggplot, or — with interactive = TRUE — an
interactive plotly chart with hover tooltips (requires the suggested
{plotly} package).
Arguments
- x
An
es_resultobject.- ci_level
Confidence level to display (default
0.95).- type
"ribbon"(default) or"errorbar". Static plots only.- interactive
Logical; if
TRUE, return an interactive plotly chart instead of a ggplot. DefaultFALSE.- show_simultaneous
Logical; overlay the simultaneous bootstrap CI band (requires
bootstrap = TRUEin the originatingevent_study()call). DefaultFALSE.- ...
Further styling arguments: for static plots
vline_val,hline_val,vline_color,hline_color,linewidth,pointsize,alpha,barwidth,color,fill,theme_style("bw","minimal", or"classic"); for interactive plotsmarkersize,show_ribbon,height,width, and the shared color arguments.
Examples
if (FALSE) { # \dontrun{
res <- event_study(df, outcome = y, time = year, timing = g,
unit = id, estimator = "cs")
plot(res)
plot(res, type = "errorbar", ci_level = 0.9)
plot(res, interactive = TRUE)
} # }