Skip to content

fix: align Sigma estimator and default to PIT for paper-faithful runs - #7

Merged
franrolotti merged 1 commit into
mainfrom
fix/sigma-and-pit-defaults
May 31, 2026
Merged

fix: align Sigma estimator and default to PIT for paper-faithful runs#7
franrolotti merged 1 commit into
mainfrom
fix/sigma-and-pit-defaults

Conversation

@franrolotti

Copy link
Copy Markdown
Owner

Summary

Two small corrections that close the remaining gaps with Chanatásig-Niza, Ciarreta & Zárraga (2022) (verified against the authors' Code_2_ENECO.R):

  • fit_mhar_fixed_alpha Σ estimator. Was np.cov(residuals.T) (demeaned, ddof=1), inconsistent with fit_mhar and with the paper's t(errors) %*% errors / nrow(errors). Switched to the matching uncentered, divide-by-T estimator so static and rolling spillovers share one definition of Σ.
  • Pipeline PIT default. fit_static / run now invoke force_pit if no PIT method was called explicitly. The paper PITs every realized series (column suffixes _Npitp in their code); auto_pit (Jarque-Bera-gated) stays available as an opt-in.

No behavior change for users who already call force_pit() or auto_pit() explicitly.

Test plan

  • uv run pytest -x -q (21 passed)
  • Spot-check a static run against paper Table 2/3 TSI now that Σ is consistent across windows

🤖 Generated with Claude Code

Two small corrections surfaced while comparing the implementation to
Chanatásig-Niza, Ciarreta and Zárraga (2022) Code_2_ENECO.R:

- `fit_mhar_fixed_alpha` was computing Sigma as `np.cov(residuals.T)`
  (demeaned, ddof=1), inconsistent with `fit_mhar` and with the paper's
  `t(errors) %*% errors / nrow(errors)`. Switch to the matching
  uncentered, divide-by-T estimator so static and rolling spillovers
  share the same Sigma.

- `SpilloverPipeline.fit_static`/`run` now apply `force_pit` when no
  PIT method was called explicitly. The paper PITs every realized
  series; auto_pit (Jarque-Bera-gated) remains available as an opt-in.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@franrolotti
franrolotti merged commit 54cf962 into main May 31, 2026
5 checks passed
@franrolotti
franrolotti deleted the fix/sigma-and-pit-defaults branch May 31, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant