Commit 91a458d
fix(wild-bootstrap): rank-aware storage vcov (CI review P1)
The estimator stored the cluster-robust vcov via compute_robust_vcov(X, ...) on
the full design, which inverts X'X directly and raises ValueError (or returns
garbage) when a nuisance column is collinear — e.g. a fixed-effect dummy
collinear with treatment on a full-dummy design — even though the ATT is
identified and wild_bootstrap_se itself drops such columns internally. Verified:
the storage call receives a rank-deficient X (rank 22 of 23) in the existing
TWFE full-dummy test, and compute_robust_vcov raises on an exactly-singular X.
Fix: compute the stored vcov through the rank-aware solve_ols(...,
rank_deficient_action="silent") path, which drops collinear columns and
NaN-expands the vcov for them — bit-identical to compute_robust_vcov on full-rank
designs (verified, ~5e-17). Removed the now-unused compute_robust_vcov import.
Test: a DiD fixed_effects design with a dummy that EXACTLY duplicates the
treatment indicator (singular X'X) — wild-bootstrap fit stays finite, no crash,
stored vcov NaN-expanded for the dropped column. Existing TWFE rank-deficient
full-dummy test still passes (both backends).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 7907d83 commit 91a458d
3 files changed
Lines changed: 62 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
826 | 825 | | |
827 | 826 | | |
828 | 827 | | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
834 | 837 | | |
835 | 838 | | |
836 | 839 | | |
837 | | - | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
838 | 847 | | |
839 | 848 | | |
840 | 849 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1435 | 1435 | | |
1436 | 1436 | | |
1437 | 1437 | | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
0 commit comments