Skip to content

Replace Rmath hypergeometric with pure Julia implementation#203

Draft
andreasnoack wants to merge 1 commit intomasterfrom
an/normath-hyper
Draft

Replace Rmath hypergeometric with pure Julia implementation#203
andreasnoack wants to merge 1 commit intomasterfrom
an/normath-hyper

Conversation

@andreasnoack
Copy link
Copy Markdown
Member

Summary

  • Port all 10 hypergeometric distribution functions from Rmath to pure Julia, based on VBA code by Ian Smith (examples3410)
  • Add helper functions logfbit, lfbaccdif1, and ab_minus_cd to misc.jl for accurate Stirling correction and cross-product computation
  • PMF via Stirling-corrected log-factorial differences, CDF via continued fraction + direct summation, inverse via normal approximation + PMF ratio stepping

Test plan

  • Existing test suite passes
  • Hypergeometric functions compared against Rmath directly (not through RFunctions)
  • Verified with larger parameter sets: (10,20,15), (50,100,80), (100,200,150)
  • Type inference verified with @inferred

🤖 Generated with Claude Code

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 22, 2026

Codecov Report

❌ Patch coverage is 79.46667% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.27%. Comparing base (37d3c86) to head (a6b520b).

Files with missing lines Patch % Lines
src/distrs/hyper.jl 78.91% 74 Missing ⚠️
src/misc.jl 87.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #203      +/-   ##
==========================================
+ Coverage   72.39%   74.27%   +1.87%     
==========================================
  Files          22       22              
  Lines        1007     1372     +365     
==========================================
+ Hits          729     1019     +290     
- Misses        278      353      +75     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreasnoack andreasnoack marked this pull request as draft March 23, 2026 08:51
@andreasnoack andreasnoack force-pushed the an/normath-hyper branch 6 times, most recently from 1fb08c5 to 22aa7c9 Compare March 23, 2026 19:50
Port hypergeometric distribution functions from Ian Smith's VBA code,
removing the dependency on Rmath for all 10 hyper functions (pdf,
logpdf, cdf, ccdf, logcdf, logccdf, invcdf, invccdf, invlogcdf,
invlogccdf).

Add helper functions logfbit, lfbaccdif1, and ab_minus_cd to misc.jl
for accurate Stirling correction and cross-product computation.
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.

2 participants