T-83: M1.4b — Pure event-study math in @stock-bot/calculations: abnormal-return fan (AAR/CAAR) around events, date-clustered Newey-West t-stat and pre/post-2023 split (no I/O)

This commit is contained in:
Studio 2026-11-28 02:23:06 -05:00
parent 1a2396916e
commit c4c99d6e8c
2 changed files with 168 additions and 37 deletions

View file

@ -149,7 +149,16 @@ export interface EventStudyRecencyGate {
readonly ratio: number | null;
}
/** Pre/post recency split summaries and sign-preserving gate decision on date-clustered CARs. */
/**
* Pre/post recency split summaries and sign-preserving gate decision on date-clustered CARs.
*
* Cohort assignment follows the event session date (`sessionDates[dayIndex] < splitDate` vs
* `>= splitDate`): each event's complete `CAR[0..postDays]` belongs to its event-date cohort.
* Consequently, a late pre-split event whose post-event window extends into the post-split
* calendar period contributes those returns to `pre`. Callers requiring strictly disjoint
* calendar return periods should exclude pre-split events whose `dayIndex + postDays` session
* falls on or after `splitDate`.
*/
export interface EventStudyRecencyResult {
readonly splitDate: string;
readonly minRatio: number;
@ -1010,6 +1019,9 @@ export function eventStudy(
};
// Sign-preserving recency gate reusing T-82's evaluateRecencyGate.
// Cohorts are split by event session date (`clusteredDates[i] < recencySplitDate` vs `>=`);
// each complete CAR[0..postDays] stays with its event date. Callers needing strictly disjoint
// return periods must pre-filter pre-split events whose post-event window reaches the split.
const rawRecency = evaluateRecencyGate(clusteredDates, clusteredMeanCars, {
recencySplitDate,
recencyMinRatio,