|
|
f87c5cb0b8
|
feat(forecasting): §9.6 key-rate sensitivity module (#951d, advisory)
Add rate_sensitivity.py: regress Δln(sales) on lagged Δ(key_rate) per segment,
gate (n≥8, r2≥0.1, slope<0), shrink toward EKB-wide prior (w=n/(n+10); EKB prior
bootstrapped from all-None spec, gate-fail→0.0 neutral), emit §9.6 explainability
phrase (X=100·(exp(β)−1), Y=lag, Z=most-sensitive Source-B bucket area floor).
Pure numpy helpers (ols_slope_r2, best_lag, shrink) DB-free + unit-tested on
synthetic series (real slope/lag recovery); compute_rate_sensitivity tested with
mocked PR1/PR2. Wrong-sign guarded 3 layers; degrades to insufficient-data /
EKB-wide form on thin/wrong-sign. ADVISORY until PR6 backtest — not wired into
any endpoint. 28 tests (forecasting/ total 141), ruff clean.
Follow-ups for PR6 backtest: validate lag selection out-of-sample (spurious-lag
on short windows), confirm _SHRINK_K + confidence thresholds before prod wiring.
|
2026-06-03 11:05:55 +05:00 |
|