new est_method inputs & outputs#255
Open
thomaswiemann wants to merge 5 commits intobcallaway11:masterfrom
Open
new est_method inputs & outputs#255thomaswiemann wants to merge 5 commits intobcallaway11:masterfrom
thomaswiemann wants to merge 5 commits intobcallaway11:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends the custom
est_methodinterface with three opt-in features. No breaking changes---all defaults areNULLand built-in methods ("dr","ipw","reg") are unaffected.est_method_vars. Character vector of column names fromdatato pass through toest_methodas adataargument, subsetted to each (g,t) cell.Cell identity forwarding. If a custom
est_methodhas formal argumentsgandt, the current group and time period are automatically passed, allowing the estimator to identify which (g,t) cell it belongs to.extra_gt. Any extra fields returned by a customest_method(beyondATTandatt.inf.func) are captured per cell and accessible viaresult$extra_gt. Useful for storing model fits for diagnostics or re-estimation.These additions facilitate broader support of custom ATT estimators including---but not exclusively---using double/debiased machine learning as in Chang (2020). (See also Ahrens et al. (2026) for a staggered DiD example with DML.) In particular,
est_method_vars+ passing alonggandtenables use of pre-assigned fold IDs for cross-fitting across group-time cells, correcting errors in existing DiD cross-fitting implementations (see, e.g., here).extra_gtallows nuisance-function estimation diagnostics and passing through pre-fitted machine learning estimators.The new features are illustrated in a DML-based DiD vignette. The vignette is not included in this PR.
AI Disclosure
Portions of this code, documentation, and tests were developed with the assistance of AI tools. I reviewed, tested, and edited all AI-generated content. All errors are my own.
References
Ahrens A, Chernozhukov V, Hansen C B, Kozbur D, Schaffer M E, Wiemann T (2026). "An Introduction to Double/Debiased Machine Learning." Journal of Economic Literature, forthcoming.
Chang NC (2020). "Double/debiased machine learning for difference-in-differences models." The Econometrics Journal, 177–191.