Skip to content

Commit 7085238

Browse files
igerberclaude
andcommitted
Rewrite optimal FLCI with first-difference reparameterization
The previous FLCI bias computation was wrong: it either pinned delta_pre=0 (making bias zero) or left levels unconstrained (making bias infinite). The paper (Section 4.1.1) parameterizes the estimator in terms of weights on pre-treatment first differences (slopes): theta_hat = l'beta_post - sum_s w_s (beta_s - beta_{s-1}) with constraint sum(w)=1 (linear trend invariance). The bias LP operates in first-difference space where Delta^SD is a bounded polyhedron |fd_{i+1} - fd_i| <= M, making the LP well-posed. New helper functions: - _build_fd_transform: maps first-differences to levels (C matrix) - _build_fd_smoothness_constraints: Delta^SD in fd-space - _w_to_v: maps slope weights w to estimator direction v _cv_alpha now supports optional df parameter using scipy.stats.nct (folded non-central t) for survey inference on the smoothness path. M=0 naturally falls out: bias=0 when sum(w)=1, optimizer just minimizes variance, giving exact linear-extrapolation weights including pre-period contribution to SE. 87/87 tests pass. New regressions: survey df=2 widens smoothness CI, M=0 SE includes pre-period variance, bias nonzero for M>0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 14f8891 commit 7085238

2 files changed

Lines changed: 292 additions & 152 deletions

File tree

0 commit comments

Comments
 (0)