Commit 7ecffd2
Move design-term uniqueness check before the regression (fail-fast)
validate_design_term_names ran just before coef_dict construction — i.e. AFTER
the OLS fit — in DifferenceInDifferences and MultiPeriodDiD, so a duplicate
assembled term name (e.g. an MPD fixed-effect dummy colliding with a structural
period_{p} key) drove a wasted rank-deficient fit and emitted a misleading
multicollinearity warning before the intended ValueError (local review P3).
Move the check to immediately after var_names is fully assembled and before the
regression call in both estimators (TwoWayFixedEffects already checked pre-fit).
var_names is not mutated between assembly and coef_dict, so this is behavior-
preserving except that the ValueError now fires fast and warning-free.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent ef4ea27 commit 7ecffd2
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
513 | 519 | | |
514 | 520 | | |
515 | 521 | | |
| |||
686 | 692 | | |
687 | 693 | | |
688 | 694 | | |
689 | | - | |
690 | 695 | | |
691 | 696 | | |
692 | 697 | | |
| |||
1680 | 1685 | | |
1681 | 1686 | | |
1682 | 1687 | | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
1683 | 1694 | | |
1684 | 1695 | | |
1685 | 1696 | | |
| |||
2038 | 2049 | | |
2039 | 2050 | | |
2040 | 2051 | | |
2041 | | - | |
2042 | | - | |
2043 | | - | |
2044 | | - | |
2045 | | - | |
| 2052 | + | |
| 2053 | + | |
2046 | 2054 | | |
2047 | 2055 | | |
2048 | 2056 | | |
| |||
0 commit comments