Commit 37bb13e
Extend PR #312 Y-normalization contract into SDID diagnostic methods
PR #312 centered and scaled Y once in SyntheticDiD.fit() to avoid
catastrophic cancellation in the SDID double-difference at extreme Y.
The fix did not reach the two public diagnostic methods on
SyntheticDiDResults: in_time_placebo() and sensitivity_to_zeta_omega()
both re-run Frank-Wolfe on the original-scale fit snapshot with
original-scale zetas, so at Y ~ 1e9 they reproduce the same silent
failure the main path was fixed for.
Capture Y_shift and Y_scale on the fit snapshot, apply the same
(Y - shift) / scale normalization inside the two diagnostic methods,
pass zeta / Y_scale and min_decrease derived from the normalized
noise level to the FW weight solvers, and rescale att / pre_fit_rmse
back to original-Y units before reporting. Unit-weight diagnostics
(max_unit_weight, effective_n) are scale-invariant and reported
without rescaling.
Regression coverage:
- TestDiagnosticScaleParity: att / pre_fit_rmse must scale by |a|
across (Y -> a*Y + b) for both diagnostic methods; a no-effect
DGP at Y ~ 1e9 must produce finite placebo atts landing within
5 * noise_level.
- TestHeterogeneousAndRampingScale: cross-unit heterogeneous scale
(units spanning 1e6 to 1e9) and cross-period ramping (trend
growing 4 orders of magnitude across periods) must leave the fit
and both diagnostic surfaces finite. These are the heterogeneity
pathways the original TestScaleEquivariance (affine-only) suite
did not cover.
Covered by audit axis A (numerical precision / scale fragility).
Findings D-4 and D-4b from docs/audits/silent-failures-findings.md.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 61aea00 commit 37bb13e
4 files changed
Lines changed: 284 additions & 45 deletions
File tree
- diff_diff
- docs/methodology
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
672 | 678 | | |
673 | 679 | | |
674 | 680 | | |
| |||
1144 | 1150 | | |
1145 | 1151 | | |
1146 | 1152 | | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1147 | 1161 | | |
1148 | | - | |
| 1162 | + | |
| 1163 | + | |
1149 | 1164 | | |
1150 | 1165 | | |
1151 | 1166 | | |
| |||
1195 | 1210 | | |
1196 | 1211 | | |
1197 | 1212 | | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
1202 | 1217 | | |
1203 | 1218 | | |
1204 | 1219 | | |
1205 | | - | |
1206 | | - | |
| 1220 | + | |
| 1221 | + | |
1207 | 1222 | | |
1208 | | - | |
1209 | | - | |
| 1223 | + | |
| 1224 | + | |
1210 | 1225 | | |
1211 | 1226 | | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
1215 | 1230 | | |
1216 | 1231 | | |
1217 | 1232 | | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
1221 | 1236 | | |
1222 | 1237 | | |
1223 | 1238 | | |
| |||
1231 | 1246 | | |
1232 | 1247 | | |
1233 | 1248 | | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
1239 | 1254 | | |
1240 | 1255 | | |
1241 | 1256 | | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
1245 | 1260 | | |
1246 | | - | |
1247 | | - | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
1248 | 1265 | | |
1249 | 1266 | | |
1250 | 1267 | | |
| |||
1320 | 1337 | | |
1321 | 1338 | | |
1322 | 1339 | | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
1323 | 1344 | | |
1324 | | - | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
1325 | 1352 | | |
1326 | 1353 | | |
1327 | | - | |
1328 | | - | |
| 1354 | + | |
| 1355 | + | |
1329 | 1356 | | |
1330 | | - | |
1331 | | - | |
| 1357 | + | |
| 1358 | + | |
1332 | 1359 | | |
1333 | 1360 | | |
1334 | | - | |
1335 | | - | |
| 1361 | + | |
| 1362 | + | |
1336 | 1363 | | |
1337 | 1364 | | |
1338 | 1365 | | |
| |||
1348 | 1375 | | |
1349 | 1376 | | |
1350 | 1377 | | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
1354 | 1381 | | |
1355 | 1382 | | |
1356 | 1383 | | |
| |||
1371 | 1398 | | |
1372 | 1399 | | |
1373 | 1400 | | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1379 | 1406 | | |
1380 | 1407 | | |
1381 | 1408 | | |
1382 | | - | |
1383 | | - | |
| 1409 | + | |
| 1410 | + | |
1384 | 1411 | | |
1385 | 1412 | | |
1386 | 1413 | | |
1387 | 1414 | | |
1388 | | - | |
1389 | | - | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
1390 | 1419 | | |
1391 | 1420 | | |
1392 | 1421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
| 670 | + | |
| 671 | + | |
670 | 672 | | |
671 | 673 | | |
672 | 674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1519 | 1519 | | |
1520 | 1520 | | |
1521 | 1521 | | |
1522 | | - | |
| 1522 | + | |
1523 | 1523 | | |
1524 | 1524 | | |
1525 | 1525 | | |
| |||
0 commit comments