-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
base: develop
Are you sure you want to change the base?
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
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 :) |
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