Skip to content

fix(distribution): estimate Hill loss tails without gains - #102

Merged
stefan-jansen merged 5 commits into
mainfrom
codex/hill-loss-tail
Oct 15, 2026
Merged

stefan-jansen merged 5 commits into
mainfrom
codex/hill-loss-tail

Conversation

@stefan-jansen

@stefan-jansen stefan-jansen commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

The lower Hill tail included large gains because it sorted absolute returns. Estimate it from negated returns instead. For tail="both", use whichever tail has enough observations when only one tail is estimable; this supports both positive-only and negative-only return samples.

Refs #89. Keep that tracking issue open until all companion fixes land.

Current head: e5e93df, based on main bb9591a. Stable patch ID be18ef40ffd9dd496ea9bf6d6ae169b76bbaab27 proves the focused diff is unchanged from the tested implementation below. All 98 current-head distribution cases passed again; the full locked suite passed 5482 tests with 7 skips on Linux/Python 3.14.3. Ruff check/format, ty, all-file hooks, strict MkDocs, 9643 links/20 external destinations, and wheel/sdist build passed. Fresh current-base hosted CI remains required.

Verification:

  • Base: 5f35459. The public lower-tail estimator returned 0.6840496943744926 on the shared mixed-sign fixture, versus loss-only reference 4.859962238129547. A negative-only Pareto sample raised ComputationError for tail="both" despite a valid lower-tail estimate.
  • Reviewed head: fd1a8ba. The lower-tail value matches the reference; positive-only and negative-only both-tail paths match their estimable single tail.
  • The added negative-only regression failed on the contributor's proposed both-tail logic before the maintainer repair.
  • Command: uv run --locked pytest -n 0 tests/test_evaluation/test_distribution.py -q. All 98 cases passed.
  • Full suite: 5475 passed, 7 skipped. Ruff lint/format, ty, pre-commit --all-files, strict MkDocs, and wheel/sdist build passed.
  • Cross-platform CI on this PR is still required before merge.

Compatibility: lower/both tail estimates change when large gains previously entered the loss tail. Samples lacking either estimable tail still fail rather than produce an unsupported estimate.

Attribution: preserves original Git authorship for @quantum-like's PR #90 commits 1d72278 and 8779ad5. Codex added the symmetric negative-only repair and failing regression, split the branch, and ran checks. AI assistance includes the original Cursor Agent commits and Codex's work and description. Maintainer review and accountability remain required.

cursoragent and others added 4 commits October 13, 2026 12:34
The lower-tail order statistics used absolute returns, so large gains
entered the loss tail and could dominate the tail index.

Co-authored-by: quantum-like <quantum-like@users.noreply.github.com>
Negated order statistics are the right loss tail, but a positive sample
has no strictly negative threshold. The both-tail path now uses the upper
tail in that case instead of failing the log transform.

Co-authored-by: quantum-like <quantum-like@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 20:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

3 participants