This repository was archived by the owner on Jan 19, 2026. It is now read-only.
add truncated negative binomial#25
Open
mfansler wants to merge 6 commits into
Open
Conversation
twolodzko
reviewed
Jun 27, 2022
Comment on lines
+158
to
+161
| double u, pa, pb; | ||
| pa = R::pnbinom(a, size, prob, true, false); | ||
| pb = R::pnbinom(b, size, prob, true, false); | ||
|
|
Owner
There was a problem hiding this comment.
This part repeats in all methods, so probably could be extracted as a separate method.
Author
There was a problem hiding this comment.
@twolodzko Please elaborate. Are you suggesting something like below?
double u, pa, pb;
tie(pa, pb) = pnbinom_ends(a, b, size, prob);We'd need a second pnbinom_ends_mu. Maybe you can propose a better name.
Owner
There was a problem hiding this comment.
I mean that calling R::pnbinom_mu and R::pnbinom with the same parameters happens several times in the code so they can be extracted as separate functions.
Owner
|
Could you rebase with master? I made some minor fixes. |
Owner
|
Besides the refactor, I don't have other comments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a truncated negative binomial distribution, including support for both
probandmuparameterizations. Tests are included, covering a similar regimen as truncated Poisson.Description is updated to minor bump the version, include the new distribution, and add authorship.