Repository navigation
Add c15/c16: Granger event controls + non-overlapping anticipation test - #3
Merged
Merged
Conversation
…w anticipation test Referee-prompted robustness runs backing the updated manuscript text: c15 re-tests the weekly sentiment->volatility lead with the 50 classified events as exogenous VAR controls (7/7 FDR survivors robust); c16 replaces the widening-window anticipation sweep with symmetric non-overlapping [-10,-4] pre-window dummies (infra unanticipated, reg modestly anticipated, asymmetry attenuates but remains directional and non-significant). Scripts verified to regenerate committed CSVs from a clean clone (py3.13, float-noise-level agreement). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot started reviewing on behalf of
Murad Farzulla (studiofarzulla)
August 4, 2026 13:31
View session
There was a problem hiding this comment.
Pull request overview
Adds two robustness-analysis steps (C15 and C16) to the existing c1–c16 pipeline, including the scripts needed to reproduce the analyses plus their committed outputs (CSVs) and accompanying FINDING write-ups for the revised manuscript.
Changes:
- Add C15 script to re-run weekly sentiment→volatility Granger tests with weekly event-dummy controls (TOTAL and SPLIT specs) and export per-pair + summary CSVs.
- Add C16 script to estimate a four-window GJR-GARCH-X specification with non-overlapping pre-event dummies ([-10,-4]) alongside the main [-3,+3] event windows, exporting per-asset + cross-asset summary CSVs.
- Add results artifacts and FINDING markdowns documenting both robustness exercises.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| results/c16-nonoverlap-pre-summary.csv | Cross-asset summary output for the non-overlapping pre-window robustness check. |
| results/c16-nonoverlap-pre-per-asset.csv | Per-asset coefficient output for the C16 four-window specification. |
| results/c16-nonoverlap-pre-FINDING.md | Narrative/interpretation of the C16 non-overlap anticipation test. |
| results/c15-granger-event-dummies.csv | Per (asset, sentiment) p-values/lags for uncontrolled vs event-controlled weekly Granger tests. |
| results/c15-granger-event-dummies-summary.csv | Tallies summarizing significance/FDR retention under event controls. |
| results/c15-event-dummy-FINDING.md | Narrative/interpretation of the C15 event-dummy control test. |
| code/c16_nonoverlap_pre_dummy.py | Implements the C16 four-window GJR-GARCH-X re-estimation and summary exports. |
| code/c15_granger_event_dummies.py | Implements the C15 conditional Granger tests with contemporaneous + lagged weekly event controls and FDR reporting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+71
to
+93
| ev = pd.read_csv(DATA_DIR / "events.csv") | ||
| ev["date"] = pd.to_datetime(ev["date"]) | ||
| wk = pd.DatetimeIndex(week_index) | ||
| edges = list(wk) + [wk.max() + pd.Timedelta(days=7)] | ||
| ev_all = np.zeros(len(wk)) | ||
| ev_infra = np.zeros(len(wk)) | ||
| ev_reg = np.zeros(len(wk)) | ||
| for _, row in ev.iterrows(): | ||
| d = row["date"] | ||
| # locate the containing week | ||
| for i in range(len(wk)): | ||
| if edges[i] <= d < edges[i + 1]: | ||
| ev_all[i] += 1 | ||
| if str(row["type"]).lower().startswith("infra"): | ||
| ev_infra[i] += 1 | ||
| elif str(row["type"]).lower().startswith("reg"): | ||
| ev_reg[i] += 1 | ||
| break | ||
| out = pd.DataFrame( | ||
| {"ev_all": ev_all, "ev_infra": ev_infra, "ev_reg": ev_reg}, | ||
| index=week_index, | ||
| ) | ||
| return out |
Comment on lines
+115
to
+139
| df = pd.DataFrame(rows) | ||
| df.to_csv(OUT_DIR / "c16-nonoverlap-pre-per-asset.csv", index=False) | ||
|
|
||
| # cross-asset means + naive one-sample t-tests (descriptive) | ||
| def summ(col): | ||
| v = df[col].values.astype(float) | ||
| t, pv = stats.ttest_1samp(v, 0.0) | ||
| return np.nanmean(v), np.nanmedian(v), float(t), float(pv) | ||
|
|
||
| summary_rows = [] | ||
| for col, lab in [("d_infra_event", "infra event [-3,+3]"), | ||
| ("d_reg_event", "reg event [-3,+3]"), | ||
| ("d_infra_pre", "infra pre [-10,-4]"), | ||
| ("d_reg_pre", "reg pre [-10,-4]")]: | ||
| m, md, t, pv = summ(col) | ||
| summary_rows.append({"coefficient": lab, "cross_asset_mean": m, | ||
| "median": md, "naive_t_vs0": t, "naive_p_vs0": pv}) | ||
| sm = pd.DataFrame(summary_rows) | ||
| ev_mult = (df["d_infra_event"].mean() / df["d_reg_event"].mean() | ||
| if df["d_reg_event"].mean() != 0 else np.nan) | ||
| sm_extra = pd.DataFrame([{"coefficient": "event-window multiplier (infra/reg)", | ||
| "cross_asset_mean": ev_mult, "median": np.nan, | ||
| "naive_t_vs0": np.nan, "naive_p_vs0": np.nan}]) | ||
| sm = pd.concat([sm, sm_extra], ignore_index=True) | ||
| sm.to_csv(OUT_DIR / "c16-nonoverlap-pre-summary.csv", index=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the two referee-prompted robustness scripts backing the updated manuscript text (c1–c16 pipeline), with their results CSVs and FINDINGs. Both verified to regenerate committed outputs from a clean clone (py3.13; agreement to float noise). Prerequisite for the preprint's updated code-availability statement.
🤖 Generated with Claude Code