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. |
||
|---|---|---|
| .. | ||
| api | ||
| integration | ||
| scrapers | ||
| services | ||
| smoke | ||
| sql | ||
| workers | ||
| __init__.py | ||
| test_admin_weight_profiles.py | ||
| test_concepts_stub.py | ||
| test_gate_verdict.py | ||
| test_health.py | ||
| test_layout_signature.py | ||
| test_layout_tz_pdf.py | ||
| test_nspd_client.py | ||
| test_nspd_sync.py | ||
| test_ping.py | ||
| test_poi_score.py | ||
| test_quarter_dump_lookup.py | ||
| test_rbac.py | ||
| test_sentry_init.py | ||
| test_velocity.py | ||
| test_weight_profiles.py | ||