Commit 3136bbd
SyntheticControl: conformal inference (Chernozhukov-Wüthrich-Zhu 2021)
Add the CWZ (2021, JASA 116(536)) conformal-inference layer for SyntheticControl
— valid p-values for the post-period effect trajectory and pointwise confidence
intervals, which the in-space placebo and Firpo-Possebom test-inversion paths
cannot give. The final SCM-roadmap inference item (PR-B style; paper review was
already on disk).
Unlike the Firpo path (re-ranks cross-unit placebo gaps), the conformal layer
fits its OWN time-permutation-invariant constrained-LS synthetic-control proxy
(CWZ §2.3 eqs 3-4 — simplex weights on raw outcomes over ALL periods under the
null, no V-matrix, no intercept) and permutes residuals OVER TIME for the single
treated unit. CWZ exactness (Lemma 1; Appendix D exchangeability) requires a
time-symmetric proxy, which the headline ADH pre-period V-fit is not — so the
conformal counterfactual is documented as distinct from the headline weights.
New module diff_diff/conformal.py (pure, reuses utils._sc_weight_fw) +
three opt-in SyntheticControlResults methods:
- conformal_test(effect, q, scheme, n_iid, seed): joint sharp-null permutation
p-value (eqs 1-2) of S_q (q in {1,2,inf}); proxy fit once, residuals permuted
(footnote 7).
- conformal_confidence_intervals(alpha, scheme, bounds, n_grid, seed): pointwise
per-period CIs by test inversion (Algorithm 1 — each period t uses Z=(pre, t),
the other post-periods dropped, a T*=1 test).
- conformal_average_effect(alpha, scheme, bounds, n_grid, seed): average-effect
CI by collapsing into non-overlapping T*-blocks and permuting block residuals
(Appendix A.1).
Permutation schemes: moving-block (default, serial-dependence-robust) and iid;
both include the identity so the p-value floor is 1/|Pi| (no extra +1).
Accessors get_conformal_grid_df() / get_conformal_ci_df() + conformal_inference
summary. Analytical se/t/p/conf_int/is_significant stay NaN throughout.
Fail-closed: <1 donor / unpickled / non-finite panel / <2 periods raise; single
donor + T*>=T0 warn; non-converged grid points are indeterminate (not rejected);
grid-edge -> "grid_limited"; nothing accepted -> "empty"; alpha<1/|Pi| ->
"unbounded" with (-inf,+inf). All five paper-pending mechanics confirmed against
arXiv:1712.09089v10.
Surfaced through DiagnosticReport (_scm_native conformal block) and wired across
REGISTRY (subsection + deviation Notes + checklist), doc-deps, references, the
LLM guides, api rst, REPORTING, CHANGELOG, README, TODO. Validated by a numpy
oracle, a brute-force permutation-equivalence test, a proxy-vs-scipy check, and a
coverage simulation. Deferred (TODO): one-sided variants (§7), covariates in the
proxy, AR/innovation permutation (Lemmas 5-7).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 75f58de commit 3136bbd
15 files changed
Lines changed: 1703 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
0 commit comments