Commit 3755a44
Codex re-review: remove float64 coercion in MPD/TWFE Conley wire-up
P1 (Methodology): the prior fix normalized `time` inside
`_compute_conley_vcov` but `MultiPeriodDiD.fit()` and
`TwoWayFixedEffects.fit()` still coerced `data[time].values.astype(np.float64)`
before passing to the helper. datetime64 / pd.Period / string time labels
fail before the helper's normalization runs, so the documented
"normalizes to dense panel-period codes" contract was unreachable on the
public estimator surfaces.
Fix: replace `.astype(np.float64)` with `np.asarray(...)` so the original
ordered labels reach the helper, which then normalizes via
`np.unique(return_inverse=True)`.
P3 (Documentation): updated the `MultiPeriodDiD` class docstring's
`vcov_type="conley"` bullet to describe the Phase 2 block-decomposed
contract (was still saying "rejected at fit-time" / "Phase 2 will add
the space-time product kernel"). Also updated the `unit` fit-arg
docstring to note it is REQUIRED when `vcov_type="conley"` rather than
"does NOT affect SE computation".
Regression: `test_multi_period_did_conley_with_datetime64_time` fits MPD
with `time_dt` (pd.to_datetime) and `time_int` (0,1,2) on the same panel
and asserts the diagonal SEs match at atol=1e-10. Verifies the end-to-end
estimator surface, not just the helper.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent fa820a8 commit 3755a44
3 files changed
Lines changed: 99 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1033 | 1033 | | |
1034 | 1034 | | |
1035 | 1035 | | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1045 | 1050 | | |
1046 | 1051 | | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1051 | 1058 | | |
1052 | 1059 | | |
1053 | 1060 | | |
| |||
1147 | 1154 | | |
1148 | 1155 | | |
1149 | 1156 | | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1153 | 1161 | | |
1154 | 1162 | | |
1155 | 1163 | | |
| |||
1550 | 1558 | | |
1551 | 1559 | | |
1552 | 1560 | | |
1553 | | - | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
1554 | 1566 | | |
1555 | 1567 | | |
1556 | 1568 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
372 | 376 | | |
373 | 377 | | |
374 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1178 | 1178 | | |
1179 | 1179 | | |
1180 | 1180 | | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1181 | 1246 | | |
1182 | 1247 | | |
1183 | 1248 | | |
| |||
0 commit comments