The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Tools for Creating and Visualizing Fixed-Effects Event Study Models
Version: 0.7.2
Date: 2026-05-02
Description: Provides functions for creating, analyzing, and visualizing event study models using fixed-effects regression. Supports staggered adoption, multiple confidence intervals, flexible clustering, and panel/time transformations in a simple workflow.
Depends: R (≥ 4.1.0)
Imports: dplyr, ggplot2, fixest, broom, tibble, rlang
License: MIT + file LICENSE
Encoding: UTF-8
Suggests: knitr, rmarkdown, haven, testthat, plotly, tidyr
VignetteBuilder: knitr
URL: https://github.com/yo5uke/fixes
BugReports: https://github.com/yo5uke/fixes/issues
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-05-02 01:02:08 UTC; yo5uk
Author: Yosuke Abe [aut, cre]
Maintainer: Yosuke Abe <yosuke.abe0507@gmail.com>
Repository: CRAN
Date/Publication: 2026-05-02 18:40:14 UTC

Autoplot for event-study results

Description

S3 method that plots an es_result (from run_es()). It forwards arguments to plot_es.

Usage

## S3 method for class 'es_result'
autoplot(object, ci_level = 0.95, type = "ribbon", ...)

Arguments

object

An es_result returned by run_es().

ci_level

Confidence level (numeric, e.g., 0.95). Passed to plot_es().

type

Plot type: "ribbon" (default) or "errorbar". Passed to plot_es().

...

Additional arguments forwarded to plot_es.

Value

A ggplot2 ggplot object.

Examples

# res <- run_es(...)
# ggplot2::autoplot(res, ci_level = 0.95, type = "ribbon")


Plot event-study results with ribbons or error bars

Description

Plot event-study results with ribbons or error bars

Usage

plot_es(
  data,
  ci_level = 0.95,
  type = "ribbon",
  vline_val = 0,
  vline_color = "#000",
  hline_val = 0,
  hline_color = "#000",
  linewidth = 1,
  pointsize = 2,
  alpha = 0.2,
  barwidth = 0.2,
  color = "#B25D91FF",
  fill = "#B25D91FF",
  theme_style = "bw"
)

Arguments

data

An object of class es_result returned by run_es().

ci_level

Confidence level to display (e.g., 0.95).

type

One of "ribbon" (default) or "errorbar".

vline_val, hline_val

Numeric locations for vertical/horizontal reference lines (default 0).

vline_color, hline_color

Colors for reference lines.

linewidth, pointsize, alpha, barwidth

Styling parameters for lines/points/bands/bars.

color, fill

Optional, override line/point color and ribbon fill.

theme_style

One of "bw", "minimal", or "classic" for ggplot theme.

Value

A ggplot object.

Examples

# Assuming `res <- run_es(...)`
# p <- plot_es(res, ci_level = 0.95, type = "ribbon")
# print(p)

Interactive event-study plot with hover details

Description

Creates an interactive plotly visualization of event study results with hover-over displays showing coefficients, confidence intervals, and other details.

Usage

plot_es_interactive(
  data,
  ci_level = 0.95,
  vline_val = 0,
  hline_val = 0,
  vline_color = "#000",
  hline_color = "#000",
  color = "#B25D91FF",
  fill = "#B25D91FF",
  alpha = 0.2,
  linewidth = 2,
  markersize = 8,
  show_ribbon = TRUE,
  height = NULL,
  width = NULL
)

Arguments

data

An object of class es_result returned by run_es().

ci_level

Confidence level to display (e.g., 0.95). Default is 0.95.

vline_val

Numeric location for vertical reference line (default 0).

hline_val

Numeric location for horizontal reference line (default 0).

vline_color

Color for vertical reference line (default "#000").

hline_color

Color for horizontal reference line (default "#000").

color

Point and line color (default "#B25D91FF").

fill

Ribbon/band fill color (default "#B25D91FF").

alpha

Ribbon transparency (default 0.2).

linewidth

Line width (default 2).

markersize

Marker size (default 8).

show_ribbon

Logical; if TRUE, shows confidence interval as a ribbon band (default TRUE).

height

Plot height in pixels (default NULL for auto).

width

Plot width in pixels (default NULL for auto).

Details

The hover tooltip displays:

Value

A plotly object that can be displayed interactively.

Examples

## Not run: 
# Assuming res <- run_es(...)
plot_es_interactive(res)
plot_es_interactive(res, ci_level = 0.99, show_ribbon = FALSE)

## End(Not run)

Event Study Estimation for Panel Data

Description

Runs an event study regression on panel data, supporting both classic (universal timing) and staggered (unit-varying timing via sunab). The function builds the design (lead/lag factor or sunab), estimates with fixest, and returns a tidy table with metadata.

Usage

run_es(
  data,
  outcome,
  treatment,
  time,
  timing,
  fe = NULL,
  lead_range = NULL,
  lag_range = NULL,
  covariates = NULL,
  cluster = NULL,
  weights = NULL,
  baseline = -1L,
  interval = 1,
  time_transform = FALSE,
  unit = NULL,
  staggered = FALSE,
  method = c("classic", "sunab"),
  conf.level = 0.95,
  vcov = "HC1",
  vcov_args = list()
)

Arguments

data

A data.frame containing panel data.

outcome

Unquoted outcome (name or expression, e.g., log(y)).

treatment

Unquoted treatment indicator (0/1 or logical). Used only when method = "classic".

time

Unquoted time variable (numeric or Date).

timing

For classic: a numeric/Date (universal) or a variable (unquoted) if staggered = TRUE. For sunab: an unquoted variable with adoption time.

fe

One-sided fixed-effects formula, e.g., ~ id + year. Can be NULL for no fixed effects.

lead_range, lag_range

Integers for pre/post windows. If NULL, determined automatically.

covariates

One-sided formula of additional controls, e.g., ~ x1 + log(x2).

cluster

Cluster specification (one-sided formula like ~ id + year, a single character column name, or a vector of length nrow(data)).

weights

Observation weights (a name/one-sided formula or a numeric vector of length nrow(data)).

baseline

Integer baseline period (default -1); reference period excluded from results for both "classic" and "sunab" methods.

interval

Numeric spacing of the time variable (default 1; ignored internally for Dates).

time_transform

Logical; if TRUE, creates consecutive integer time within unit.

unit

Unit identifier variable (required when time_transform = TRUE); also used for metadata when supplied.

staggered

Logical; if TRUE, timing is a variable (classic) or is used by sunab.

method

Either "classic" or "sunab" (default: "classic").

conf.level

Numeric vector of confidence levels (default 0.95).

vcov

VCOV type passed to fixest::vcov() or used via broom::tidy(vcov = ...). Default "HC1".

vcov_args

List of additional arguments forwarded to fixest::vcov().

Value

A data.frame of class "es_result" with columns:

Attributes include: lead_range, lag_range, baseline, interval, call, model_formula, conf.level, N, N_units, N_treated, N_nevertreated, fe, vcov_type, cluster_vars, staggered, sunab_used.

Key Features

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.