T-85: M1.4c — analyzeSignal / runEventStudy study runners in @stock-bot/research: analyzer math + automatic trial_ledger write + cluster N̂-deflated Sharpe (no new dependencies)

This commit is contained in:
Studio 2026-11-28 03:36:04 -05:00
parent 45a98d309e
commit 9d8dfc9bc8
4 changed files with 299 additions and 13 deletions

View file

@ -49,10 +49,11 @@ Exported from both `@stock-bot/research` and `@stock-bot/research/signal-study`
| `analyzeSignal` (`ledgerSeries: 'quantile_spread'`) | `'signal_ic'` | `analysis.quantiles.spreadSeries` | `analysis.quantiles.dates` |
| `runEventStudy` | `'event_study'` | `study.clustered.meanCars` | `study.clustered.dates` |
### Vault Holdout Behavior
### Vault Holdout & Cluster DSR Behavior
- **`analyzeSignal`** delegates to `analyzeSignalPanel`'s exclusive `vaultCutoffDate` fence, excluding all cross-sections with `date >= vaultCutoffDate` (reported in `analysis.diagnostics.vaultExcludedDates`) so `sampleEnd < vaultCutoffDate`. Callers assembling pre-computed forward-return panels remain responsible for ensuring forward-return horizons do not consume post-cutoff prices.
- **`runEventStudy`** drops every event where `sessionDates[dayIndex] >= vaultCutoffDate` or `sessionDates[dayIndex + postDays] >= vaultCutoffDate` without mutating caller inputs, reporting the count in `vaultExcludedEvents`.
- **`runEventStudy`** validates return-array shapes against the original `sessionDates` calendar, drops every event where `sessionDates[dayIndex] >= vaultCutoffDate` or `sessionDates[dayIndex + postDays] >= vaultCutoffDate` (reported in `vaultExcludedEvents`), and passes only the pre-cutoff calendar and matching return prefixes to `eventStudy` without mutating caller inputs so held-out Vault-tail values (including non-finite returns) never leak into or fail pre-Vault studies.
- **Count-based DSR fallback:** Because `analyzeSignal` and `runEventStudy` supply `observationDatesByTrialId` only for the newly written trial and no shared session grid for historical trials in the cluster, `clusterDeflatedSharpe` skips unaligned historical correlation pairs (`pairsUsed === 0`, `pairsSkipped === clusterSize * (clusterSize - 1) / 2`) and falls back conservatively to count-based `effectiveTrials === clusterSize`. Callers needing correlation-aware `effectiveTrials` across historical trials should invoke `clusterDeflatedSharpe` directly with a trusted `sessionDates` calendar or per-trial `observationDatesByTrialId`.
### `SignalStudyError` Codes