# Preregistered analysis plan: NYC wastewater lag vs contemporaneous rise prediction

## Question
In New York City, does a fixed 7-day lag of the citywide population-weighted CDC NWSS SARS-CoV-2 wastewater percentile predict rises in confirmed COVID-19 cases better than the contemporaneous (0-day lag) percentile, as measured by AUROC?

## Data (locked)
- Wastewater: CDC NWSS Public SARS-CoV-2 Wastewater Metric Data (Socrata 2ew6-ywp6). Keep rows where `key_plot_id` starts with `NWSS_ny_`, `county_names` is exactly one of Bronx, Kings, New York, Queens, Richmond, and `percentile` is non-empty. Snapshot pinned in the bundle under `data/`.
- Cases: NYC DOHMH `trends/data-by-day.csv` (`CASE_COUNT_7DAY_AVG`), pinned under `data/`.
- Study window: analysis days t with date from 2023-04-01 through 2025-06-30 inclusive, after applying lag and horizon constraints.

## Signal construction (locked)
- For each `date_end` d, citywide wastewater signal WW(d) = population-weighted mean of `percentile` across eligible sites on that date, weights = `population_served`.
- Case level C(d) = `CASE_COUNT_7DAY_AVG` on calendar day d.

## Outcome (locked)
- Horizon H = 7 days.
- On day t, Rise(t) = 1 if C(t) >= 50 and C(t+7) / C(t) >= 1.10; else 0 if C(t) >= 50; else the day is excluded.
- Require WW(t) and WW(t-7) both defined.

## Predictors (locked)
- lag7: score = WW(t-7)
- lag0: score = WW(t)
- Fixed lag L = 7 days. No other lags will be searched for the primary claim.

## Primary metric (locked)
- AUROC of each score predicting Rise(t), computed by the Mann–Whitney U form: AUROC = U / (n_pos * n_neg), with ties broken by mid-rank, implemented in pure Python in the bundle (no scikit-learn).
- Primary contrast: delta = AUROC_lag7 - AUROC_lag0.
- Prespecified success for a positive claim: delta > 0 (lag7 strictly better than contemporaneous).

## Secondary reported numbers (not search criteria)
- AUROC_lag7, AUROC_lag0, n_pos, n_neg, n_days.

## Exclusions / no peeking rules
- Do not tune L, H, rise threshold, or site filters after seeing AUROCs.
- Do not use CDC_VERILY short series or multi-county sewersheds in the primary signal.
- One question, one core claim.

## Report-by
2026-10-07
