# setzler/eventstudy architecture

> Architecture diagram of the GitHub repository setzler/eventstudy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/setzler/eventstudy
- Repository: https://github.com/setzler/eventstudy

## Overview

eventStudy is a deprecated R package for estimating event-study treatment effects from long-format panel data. Its documented user workflow is to provide data and variable names to `ES`, which produces event-study estimates; users can then plot levels or treatment effects. Major documented capabilities include stacked controls, cohort-specific or pooled effects, anticipation handling, and adjustments for non-parallel trends. A built-in simulator is also documented. Source excerpts were unavailable, so internal call relationships beyond the README-described workflow are not asserted.

Main entry points: [`eventStudy/R/ES.R`](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/ES.R) (ES command), [`eventStudy/R/plot_functions.R`](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/plot_functions.R) (Result plots), [`eventStudy/R/simulate.R`](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/simulate.R) (Data simulator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Analysis workflow"]
  node_es["ES command<br/>[ES.R]"]
end

subgraph group_estimation["Treatment estimation"]
  node_stacking["Stacked controls<br/>[by_cohort_ES.R]"]
  node_cohort["Cohort effects"]
  node_pooled["Pooled effects<br/>[estimate_ATT.R]"]
  node_inference["Bootstrap inference<br/>[bootstrap_ses.R]"]
end

subgraph group_adjustments["Trend adjustments"]
  node_anticipation["Anticipation handling<br/>[pre_process.R]"]
  node_trend_adjust["Trend adjustments<br/>[wald_ES.R]"]
  node_covariate_balance["Covariate balancing<br/>[ipw.R]"]
end

subgraph group_outputs["Results and tools"]
  node_estimates["Event-study estimates<br/>[ES.R]"]
  node_plots["Result plots<br/>[plot_functions.R]"]
  node_simulator["Data simulator<br/>[simulate.R]"]
end

node_analyst(("Analyst"))
node_panel["Panel data"]

node_analyst -->|"runs"| node_es
node_panel -->|"provides data"| node_es
node_es -->|"estimates effects"| node_estimates
node_estimates -->|"plots results"| node_plots
node_analyst -->|"simulates data"| node_simulator

click node_es "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/ES.R"
click node_stacking "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/by_cohort_ES.R"
click node_cohort "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/by_cohort_estimate_ATT.R"
click node_pooled "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/estimate_ATT.R"
click node_anticipation "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/pre_process.R"
click node_trend_adjust "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/wald_ES.R"
click node_covariate_balance "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/ipw.R"
click node_inference "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/bootstrap_ses.R"
click node_estimates "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/ES.R"
click node_plots "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/plot_functions.R"
click node_simulator "https://github.com/setzler/eventstudy/blob/master/eventStudy/R/simulate.R"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_es toneBlue
class node_stacking,node_cohort,node_pooled,node_inference toneAmber
class node_anticipation,node_trend_adjust,node_covariate_balance toneMint
class node_estimates,node_plots,node_simulator toneRose
class node_analyst,node_panel toneIndigo
```

## Components

### Analysis workflow

- [ES command](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/ES.R): `eventStudy/R/ES.R`

### Treatment estimation

- [Stacked controls](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/by_cohort_ES.R): `eventStudy/R/by_cohort_ES.R`
- [Cohort effects](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/by_cohort_estimate_ATT.R): `eventStudy/R/by_cohort_estimate_ATT.R`
- [Pooled effects](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/estimate_ATT.R): `eventStudy/R/estimate_ATT.R`
- [Bootstrap inference](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/bootstrap_ses.R): `eventStudy/R/bootstrap_ses.R`

### Trend adjustments

- [Anticipation handling](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/pre_process.R): `eventStudy/R/pre_process.R`
- [Trend adjustments](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/wald_ES.R): `eventStudy/R/wald_ES.R`
- [Covariate balancing](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/ipw.R): `eventStudy/R/ipw.R`

### Results and tools

- [Event-study estimates](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/ES.R): `eventStudy/R/ES.R`
- [Result plots](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/plot_functions.R): `eventStudy/R/plot_functions.R`
- [Data simulator](https://github.com/setzler/eventstudy/blob/master/eventStudy/R/simulate.R): `eventStudy/R/simulate.R`

### Other components

- **Analyst**
- **Panel data**

## Connections

- Analyst → ES command: runs (evidence: `README.md`)
- Panel data → ES command: provides data (evidence: `README.md`)
- ES command → Event-study estimates: estimates effects (evidence: `README.md`)
- Event-study estimates → Result plots: plots results (evidence: `README.md`)
- Analyst → Data simulator: simulates data (evidence: `README.md`)
