The {fetwfe}
package implements fused extended
two-way fixed effects (FETWFE), a methodology for estimating
treatment effects in difference-in-differences with staggered
adoptions.
To install the {fetwfe}
package, simply use
install.packages("fetwfe")
You can also install the latest development version by using
# install.packages("remotes") # if needed
::install_github("gregfaletto/fetwfePackage") remotes
The primary function in the {fetwfe}
is
fetwfe()
, which implements fused extended two-way fixed
effects. Here’s some example code that implements the data application
from the paper:
library(fetwfe)
library(bacondecomp)
set.seed(23451)
data(divorce)
<- fetwfe(
res pdata=divorce[divorce$sex == 2, ],
time_var="year",
unit_var="st",
treatment="changed",
covs=c("murderrate", "lnpersinc", "afdcrolls"),
response="suiciderate_elast_jag",
q=0.5,
verbose=TRUE)
summary(res)
For a vignette and full documentation, check out the page for the
{fetwfe}
package on CRAN.