Closed kylebutts closed 2 years ago
FWIW did2s estimation objects should work out of the box with ggiplot. In most cases, a simple ggiplot::ggiplot(object)
call should suffice, but it's easy to customise beyond that.
library(did2s)
#> Loading required package: fixest
#> ℹ did2s (v0.4.0). For more information on the methodology, visit <https://www.kylebutts.com/did2s>
#> To cite did2s in publications use:
#>
#> Butts, Kyle (2021). did2s: Two-Stage Difference-in-Differences
#> Following Gardner (2021). R package version 0.4.0.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> title = {did2s: Two-Stage Difference-in-Differences Following Gardner (2021)},
#> author = {Kyle Butts},
#> year = {2021},
#> url = {https://github.com/kylebutts/did2s/},
#> }
library(ggiplot)
#> Loading required package: ggplot2
data("df_hom")
es = did2s(df_hom,
yname = "dep_var", treatment = "treat", cluster_var = "state",
first_stage = ~ 0 | unit + year,
second_stage = ~ i(rel_year, ref=c(-1, Inf)))
#> Running Two-stage Difference-in-Differences
#> • first stage formula `~ 0 | unit + year`
#> • second stage formula `~ i(rel_year, ref = c(-1, Inf))`
#> • The indicator variable that denotes when treatment is on is `treat`
#> • Standard errors will be clustered by `state`
ggiplot(es)
Created on 2022-03-31 by the reprex package (v2.0.1)
Created on 2022-03-07 by the reprex package (v2.0.1)