-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathREADME.Rmd
More file actions
75 lines (55 loc) · 2.59 KB
/
README.Rmd
File metadata and controls
75 lines (55 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# eventstudyr <img src='man/figures/logo.png' align="right" height="139" />
<!-- badges: start -->
[](https://CRAN.R-project.org/package=eventstudyr)
[](https://r-pkg.org/pkg/eventstudyr)
<!-- badges: end -->
## Overview
The **eventstudyr** package implements tools for estimating linear panel event study models, following the recommendations in [Freyaldenhoven et al. (2021)](https://www.nber.org/papers/w29170).
Includes sup-t bands, testing for key hypotheses, least wiggly path through the Wald region.
Allows instrumental variables estimation following [Freyaldenhoven et al. (2019)](https://www.aeaweb.org/articles?id=10.1257/aer.20180609).
## Installation
```{r, eval = FALSE}
# Install from CRAN
install.packages("eventstudyr")
# Install latest version from GitHub
install.packages("devtools")
devtools::install_github("JMSLab/eventstudyr")
```
## Usage
Find a minimal example below.
For more examples see the package [documentation](https://cran.r-project.org/package=eventstudyr/eventstudyr.pdf) and [vignette](https://cran.r-project.org/package=eventstudyr/vignettes/documentation.html).
```{r example}
#| fig.alt = "Event-study plot using the example data of the package
#| and default plotting options."
library(eventstudyr)
set.seed(10) # for reproducibility of sup-t bands
estimates_ols <- EventStudy(
estimator = "OLS",
data = example_data, # Use package sample data
outcomevar = "y_smooth_m",
policyvar = "z",
idvar = "id",
timevar = "t",
controls = "x_r",
pre = 0, post = 4
)
plt <- EventStudyPlot(estimates = estimates_ols)
plt
```
## Citation
Simon Freyaldenhoven, Christian Hansen, Jorge Pérez Pérez, and Jesse M. Shapiro. "Visualization, Identification, and Estimation in the Panel Event-Study Design." [NBER Working Paper No. 29170](https://www.nber.org/papers/w29170),
August 2021.
Simon Freyaldenhoven, Christian Hansen, Jorge Pérez Pérez, Jesse M. Shapiro, Veli M. Andirin, Richard Calvo, Santiago Hermo, Nathan Schor, Emily Wang. "`eventstudyr` package." Code and data repository at https://github.com/JMSLab/eventstudyr, March 2023.
## Acknowledgments
Thank you to Eliana Sena Sarmiento and Melissa Wu for their excellent work testing and reviewing `eventstudyr` prior to its public release.