-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
add beta_neg_binomial_lccdf #3114
add beta_neg_binomial_lccdf #3114
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments but overall looks good!
param[0] = 10; // n | ||
param[1] = 5.5; // r | ||
param[2] = 2.5; // alpha | ||
param[3] = 0.5; // beta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some test for more extreme values? Mostly so we can make sure we have good precision at the bounds of the support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add more in the next commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't add too many tests. Cuz if the values are extreme, grad_F32
would be too complex. We have to increase max allowed iterations to pass tests, then the tests might run for years lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though I do test on local for all parameters = 1e-3 or 1e3, increase max_steps to 1e-8 can pass tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats fine. Let's leave it at 1e-8 because we don't really know where the algorithm / user is going to end up in the parameter space.
Hey @SteveBronder, are there any other changes you'd like to suggest? |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
Hi @SteveBronder, all tests passed. I think we are ready to merge :) |
Hi sorry I was working on a big pr for the next release and am at a conference for work right now. But Friday I'll look at this |
…that are needed. Small cleanup for beta_neg_binomial_lccdf
…omial-lccdf' into HEAD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay. I looked this over and tried to make some changes to speed up the fvar<fvar<var>>
tests. This looks good to me, but can you take a look 939f03c to make sure my changes make sense.
Otherwise we are good to go!
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
These changes make sense. Happy to go! |
Note that merging this seems to have caused the develop pipeline to have gone from ~15h to a day and counting: https://jenkins.flatironinstitute.org/blue/organizations/jenkins/Stan%2FMath/detail/develop/301/ Not sure if this is repeatable or just a hiccup, we will need to monitor |
This issue is reproducible, likely due to this merge. I think the best way is to specifically adjust the |
Before that we can disable this test for other PRs to pass pipeline |
Just passed two days, I think we need to either disable that test or revert this PR until resolved |
Summary
With this PR the lccdf of beta negative binomial distribution are added.
See issue #3113
Expressions involved:
CCDF$C(r,\alpha,\beta)$ :
where$F(r,\alpha,\beta)$ is CDF, we denote ${~}_3F_2({1,r+y +1,\beta +y +1}; {y +2,r+\alpha +\beta +y +1};1)$ as $_3F_2(...)$
Partial derivatives:
where
These can be obtained by
grad_F32
.Tests
Test is written follow the guide.
Side Effects
grad_F32
may have some precision issues, causing a few tests to fail. This has been resolved by increasing precision from 1e-6 to 1e-8.Release notes
beta_neg_binomial_lccdf is available if merged.
Checklist
Copyright holder: Zhi Ling
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested