> ## Documentation Index
> Fetch the complete documentation index at: https://calendar-effects.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 0006. Batch event study outputs and tests

* **Date:** 2026-11-17
* **Status:** Agreed 2026-11-25 (proposed by Areej)
* **Agreed by:** Mahad (2026-11-25), for the team

## Context

The streaming vs batch comparison (task #9) needs the batch CARs (the "answer key", task #8) in a known format. The report needs significance tests that hold up even though all retailers share the same event dates. Decision 0004 fixed the study settings; this decision fixes the outputs.

## Decision

* **`batch_event_car` has exactly the columns of `stream_event_car`,** computed by `src/eventstudy/car.py` from `clean/master.parquet` with the settings in `common.study`. Same keys (`ticker`, `event_type`, `event_date`), events from `expand_events`, day 0 the first trading day on or after the event date, one market model per window fitted on days −125..−6. Attention z-scores follow the stream's rule. The comparison expects equal values. Checked on 2026-11-17: all 600 windows match the streaming logic (`streaming.signals.update`) to about 1e-15.
* **The batch code is written independently of `src/streaming/signals.py`** (numpy on whole arrays instead of day-by-day state), so agreement checks both.
* **Significance** (`src/eventstudy/stats.py`, tables `batch_car_summary` and `batch_car_trend`):
  * the main test and the confidence intervals use **standard errors clustered by event date** (day 0), because the 10 retailers' CARs on the same date are not independent
  * also reported: the t-test, the Wilcoxon signed-rank test and a BMP-style test on `car_z` (without BMP's prediction-error correction)
  * online vs store: the difference of group means per event date, tested across dates
  * trend: the mean CAR of each event date regressed on its year
  * `all` event types: windows with the same ticker and day 0 (US Thanksgiving and Black Friday) count once
  * the confidence level is `common.study.CONFIDENCE` (95%)
* **Outputs** go to `data/results/` (gitignored); each file has a `.json` next to it with the code version that made it.

## Alternatives considered

* **Only the t-test:** it treats 100 Black Friday windows as 100 independent results when there are really 10 event dates, so p-values come out too small. On our data, Prime Day's p-value is 0.014 under the plain t-test but 0.054 clustered.
* **A smaller batch output (CAR only):** simpler, but the comparison could then not check alpha, beta, `n_days` or the attention columns.

## Consequences

* **Mahad:** task #9 can join `data/results/batch_event_car.parquet` to the stream's `event_car` on `ticker, event_type, event_date` and expect zero difference. Run `python3 src/eventstudy/car.py` first (about 2 seconds).
* **Report:** quote `p_clustered` and the clustered confidence intervals as the main result, and state `n_events` and `n_tickers` in every table.
* **`scipy`** is added to `requirements.txt`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.