esplot: Event Study Visualization

View source: R/esplot.R

esplotR Documentation

Event Study Visualization

Description

Visualize the dynamic treatment effects and create an event study plot.

Usage

    esplot(data, Period, Estimate, SE, CI.lower = NULL,
        CI.upper = NULL, Count = NULL, fill.gap = TRUE,
        start0 = FALSE, show.count = NULL, stats = NULL,
        stats.labs = NULL, highlight.periods = NULL,
        highlight.colors = NULL, main = NULL,
        xlim = NULL, ylim = NULL,
        xlab = NULL, ylab = NULL,
        gridOff = FALSE, stats.pos = NULL,
        theme.bw = TRUE, cex.main = NULL,
        cex.axis = NULL, cex.lab = NULL,
        cex.text = NULL, axis.adjust = FALSE)

Arguments

data

The input data for the event study plot.

Period

The variable name of the relative period.

Estimate

The variable name of the estimated coefficient.

SE

The variable name of the standard errors. Omitted if CI.lower and CI.upper are specified.

CI.lower

Optional. The variable name of the lower confidence interval.

CI.upper

Optional. The variable name of the upper confidence interval.

Count

Optional. The variable name indicating the number of treated observations for each time period.

fill.gap

Logical. Whether to use 0 values to fill gaps in dynamic treatment effects. Default is TRUE.

start0

Logical. Whether period 0 should be considered as the first post-treatment period. Default is FALSE.

show.count

Logical. Whether to display the bar plot of the number of observations at the bottom of the plot.

stats

Optional. A list of statistics to be printed on the plot.

stats.labs

Optional. The names corresponding to stats.

highlight.periods

Optional. A list of periods to highlight.

highlight.colors

Optional. A list of colors for highlighting periods.

main

Optional. The title of the plot.

xlim

Optional. The limits of the x-axis.

ylim

Optional. The limits of the y-axis.

xlab

Optional. The label for the x-axis.

ylab

Optional. The label for the y-axis.

gridOff

Logical. Whether to turn off grid lines. Default is FALSE.

stats.pos

Optional. The position of the printed statistics.

theme.bw

Logical. Whether to use a black-and-white theme. Default is TRUE.

cex.main

Optional. The font size for the plot title.

cex.axis

Optional. The font size for the axis labels.

cex.lab

Optional. The font size for the axis tick labels.

cex.text

Optional. The font size for other text elements in the plot.

axis.adjust

Logical. Whether to adjust the axis position. Default is FALSE.

Value

p

A ggplot object of the event study plot.

Author(s)

Licheng Liu, Yiqing Xu, Ziyi Liu, Zhongyu Yin


xuyiqing/fect documentation built on April 12, 2025, 9:50 p.m.