LWDID: Stata module to implmenent Rolling Difference-in-Differences Estimator for Small-N and Large-N Panel Data
Soo Jeong Lee () and
Jeffrey Wooldridge
Additional contact information
Soo Jeong Lee: Southern Illinois University Carbondale
Statistical Software Components from Boston College Department of Economics
Abstract:
lwdid implements the transformation-based rolling Difference-in-Differences estimators developed in Lee and Wooldridge (2025, 2026a). The command provides a unified implementation for panel data settings with either a large-N or a small-N cross-sectional dimension, allowing treatment effects to be estimated under both the staggered treatment adoption and the common timing case. The central idea is to transform outcomes within each unit to remove pre-treatment means, trends, or seasonal components, yielding residualized outcomes. These transformed outcomes allow treatment effects to be estimated using simple cross-sectional regressions in each post-treatment period, facilitating both overall and period-specific ATT estimation. By default, lwdid uses the large-N procedure of Lee and Wooldridge (2025), which is designed for panels with a large cross-sectional dimension and allows for heterogeneous treatment effects and unit-specific heterogeneous linear trends. When the cross-sectional dimension is small (small-N), conventional large-N inference may be unreliable. In such settings, specifying the small option invokes the exact small-sample inference procedures developed in Lee and Wooldridge (2026a). The seasonal-adjustment options demeanq, detrendq, demeanm, and detrendm are currently available only under the small-N implementation. Based on the treatment cohort variable specified in gvar(), lwdid automatically detects whether the design involves a single treatment cohort (common timing) or multiple cohorts (staggered adoption) and applies the appropriate estimation procedure.
Language: Stata
Requires: Stata version 16
Keywords: DiD; panel data; treatment effects (search for similar items in EconPapers)
Date: 2026-04-17, Revised 2026-04-28
Note: This module should be installed from within Stata by typing "ssc install lwdid". The module is made available under terms of the MIT license (https://opensource.org/licenses/MIT).
References: Add references at CitEc
Citations:
Downloads: (external link)
http://fmwww.bc.edu/repec/bocode/l/lwdid.ado program code (text/plain)
http://fmwww.bc.edu/repec/bocode/l/lwdid.sthlp help file (text/plain)
http://fmwww.bc.edu/repec/bocode/l/lw_castle.dta sample data file (application/x-stata)
http://fmwww.bc.edu/repec/bocode/l/lw_smoking.dta sample data file (application/x-stata)
http://fmwww.bc.edu/repec/bocode/l/lw_walmart.dta sample data file (application/x-stata)
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:boc:bocode:s459672
Ordering information: This software item can be ordered from
http://repec.org/docs/ssc.php
Access Statistics for this software item
More software in Statistical Software Components from Boston College Department of Economics Boston College, 140 Commonwealth Avenue, Chestnut Hill MA 02467 USA. Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().