Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pathintdid

pathintdid implements the Path-Integrated Difference-in-Differences (PI-DiD) framework of Salavi (2026), "Path-Integrated Difference-in-Differences (PI-DiD): Identification, Estimation, and Inference for Cumulative Treatment Effects" (working paper, African School of Economics).

Instead of comparing treated and control outcomes at a single endline date, PI-DiD treats the treatment effect as a trajectory tau(t) = c1(t) - c0(t) and integrates the baseline-differenced gap over a post-treatment window [t0, t1] (trapezoidal rule) to obtain a cumulative causal effect, sigma, and a path-integrated average treatment effect on the treated, tau-bar = sigma / (t1 - t0). This avoids the endpoint-subtraction bias: whenever a policy's effect is transitory and the treated/control trajectories fully rejoin by the evaluation date, the conventional static difference-in-differences estimate can be exactly zero even though the cumulative benefit delivered to treated units was strictly positive.

This package is an R port of the original Stata package (pathintdid, pathintdidplot, pathintdidrobust), rebuilt for CRAN with cluster-style standard errors, confidence intervals, base-graphics diagnostic plots, and the section-5 robustness/specification-test suite of the companion paper.

Installation

# install.packages("pathintdid")   # once available on CRAN

# development version:
# install.packages("remotes")
remotes::install_github("FabriceSALAVI/PathIntDID")

Usage

library(pathintdid)
data(trainingpanel)

## Cumulative effect, path-integrated ATT, and the static DiD, with SEs
fit <- pathintdid(trainingpanel, yname = "consumption", idname = "id",
                   tname = "time", treatname = "treat", t0 = 0, t1 = 5)
fit

## Treated vs. counterfactual paths, and the running cumulative effect
pathintdidplot(trainingpanel, yname = "consumption", idname = "id",
               tname = "time", treatname = "treat", t0 = 0, t1 = 5)

## Pre-trends placebo test, grid-sensitivity check, anticipation bounds
pathintdidrobust(trainingpanel, yname = "consumption", idname = "id",
                  tname = "time", treatname = "treat",
                  t0 = 2, t1 = 4, maxanticip = 2)

Functions

Function Purpose
pathintdid() Point estimates and inference for sigma, tau-bar, and the static DiD.
pathintdidplot() Treated/counterfactual path plot and running cumulative-effect plot.
pathintdidrobust() Pre-trends placebo test, grid/quadrature sensitivity, anticipation bounds.

Citation

If you use this package, please cite:

Salavi, C. A.-F. (2026). Path-Integrated Difference-in-Differences (PI-DiD): Identification, Estimation, and Inference for Cumulative Treatment Effects. Working paper, African School of Economics.

License

MIT

About

What the Package Does (One Line, Title Case)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages