Negative binomial sampling bug when p=0
See original GitHub issueNegative binomial sample when p=0:
np.random.negative_binomial(1, 0)
I believe the output should be 0 in this case.
1.18.2 3.7.3 (default, Mar 31 2019, 11:50:42) [Clang 10.0.1 (clang-1001.0.46.3)]
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Sampling Theory of the Negative Binomial and Logarithmic ...
If colonies or groups of individuals are distributed randomly over an area (or in time) so that the number of colonies observed in...
Read more >Fitting the Negative Binomial Distribution to Biological Data
Since the expected variance of a Poisson distribution is equal ... Po = 1/qk, and if P0 is replaced by the proportion observed...
Read more >Error in wp.logistic: 'p0' must be numeric in (0,1)? What to do ...
p0 and p1 are probabilities, and can't be negative. Share. Share a link to this answer.
Read more >Using the negative binomial distribution to model ...
Scenarios for how sampling error, flocking, and environmental stochasticity might cause overdispersion in daily bird migration count data. Each ...
Read more >The Negative Binomial Distribution
When sampling without replacement from a finite sample of size n from a dichotomous (S–F) population with the population size N, the hypergeometric...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
P.S. @adamgayoso, thanks for reporting the issue!
@adamgayoso, the pull request gh-15914, in which the
negative_binomial
method ofnumpy.random.Generator
is changed to disallow p=0, has been merged. With the master branch of numpy (and using the new numpy.random API), we have:Note, however, that the function
numpy.random.negative_binomial
has not also been updated. That function is part of the “legacy” random API. The legacy code is usually only updated if a bug causes Python to crash. If you are writing new code, you should use the new API.