OgO
  olivier godechot

lpdidcsa, a R package for difference-in-differences event-study models

This R package, developed with Ulysse Lojkine, implements the Local-Projection Difference-in-Differences (LP-DiD) models proposed by Dube et al. (2025). These models efficiently estimate difference-in-differences treatment effects on large databases. Our package incorporates an inverse probability weighting strategy into the LP-DiD method for handling covariates, as described in our working paper with Ulysse. We also implement the estimation of cohort-specific treatment effects à la Callaway and Sant'Anna (2021) within a local projection regression framework, which also serves as a pedagogical tool for understanding the connection between CSA and LP-DiD methods. 

Package and documentation can be downloaded here : 
https://github.com/oliviergodechot/lpdidcsa  

Otherwise directly into R: 

remotes::install_github("oliviergodechot/lpdidcsa")
library("lpdidcsa")
# Example 2 with toydataset mimicking a linked employer-employee panel dataset ----
toydata <- sim_staggered_panel(n=10000,n_firm=500)
nrow(toydata)

df_w  <- lpdidcsa_data(toydata, 
                     unit = "id", 
                     time = "t",
                     dependent = "log_earnings",
                     treat = "treat", # treatment dummy variable
                     n_pre = 12, # number of pre-treatment periods
                     n_post= 12, # number of post-treatment periods
                     h_variables="firm_id" # other variables for which all horizons are computed
                     )
colnames(df_w)

res <- lpdidcsa(df_w, 
                unit = "id", 
                time = "t",
                dependent = "log_earnings", 
                meth = "lpdid_ipw", 
                n_pre=12, # number of pre-treatment periods
                n_post=12, # number of post-treatment periods
                controls=c("female"), # horizon invariant control variables
                clusters="firm_id_tm1", # horizon invariant clustering variable
                clusters_h="firm_id", # horizon specific clustering variable
                FE="firm_id_tm1" # horizon invariant fixed effects
                )
res$plot   # event study plot
res$est    # coefficient table
res$ps    # coefficient table for the first stage propensity score


English | Français

Actualités   

OgO: plus ici|more here

[Working papers] Godechot, Olivier and Ulysse Lojkine. 2026. Cutting hours through outsourcing, World Inequality Lab, Working Paper n°2026/10. ...: plus ici|more here

[Webmestre]

[Fil rss]

[V. 0.93]
HOP

Système d'aide à la publication sur Internet