Skip to content

new est_method inputs & outputs#255

Open
thomaswiemann wants to merge 5 commits intobcallaway11:masterfrom
thomaswiemann:improved-est_method
Open

new est_method inputs & outputs#255
thomaswiemann wants to merge 5 commits intobcallaway11:masterfrom
thomaswiemann:improved-est_method

Conversation

@thomaswiemann
Copy link

Summary

This PR extends the custom est_method interface with three opt-in features. No breaking changes---all defaults are NULL and built-in methods ("dr", "ipw", "reg") are unaffected.

  • est_method_vars. Character vector of column names from data to pass through to est_method as a data argument, subsetted to each (g,t) cell.

  • Cell identity forwarding. If a custom est_method has formal arguments g and t, 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 custom est_method (beyond ATT and att.inf.func) are captured per cell and accessible via result$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 along g and t enables 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_gt allows 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant