Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up pdf, cdf, mean, and var for FisherNoncentralHypergeometric #1277

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

andreasnoack
Copy link
Member

by implementing the method of Liao and Rosen. For the case in JuliaStats/HypothesisTests.jl#224, I saw a 200k times speed up for cdf with this change.

Copy link
Contributor

@pdeffebach pdeffebach left a comment

Choose a reason for hiding this comment

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

The calculation seems to match the paper's and tests pass. So looks good to me, but I am not a great expert on this.

fᵢ /= rᵢ₊

# break if terms no longer contribute to s
sfᵢ = s + fᵢ
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be explicit about the tolerance here? Is there some assumption here about how small f_i gets?

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea here is to go as far as the precision allows, i.e. until f_i is so small that it can't change s. In that way, it shouldn't be necessary to introduce an explicit tolerance.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good!

@andreasnoack
Copy link
Member Author

If anybody has further comments please share them soon. Otherwise, I'll go ahead a merge in a couple of days.

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