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

Already on GitHub? Sign in to your account

BUG: fix precision issue with nbinom.pmf. Closes ticket 1779. #371

Merged
merged 1 commit into from Dec 2, 2012

Conversation

Projects
None yet
3 participants
Owner

rgommers commented Dec 2, 2012

No description provided.

Member

josef-pkt commented Dec 2, 2012

Thanks Ralf and bioinformed, Looks good to me

@pv a "special" question since you looked into similar issues recently
Do you know if it makes a difference for some relevant parameters?
betaln could replace 3 calls to gammaln, but I haven't seen any case yet in scipy.stats and in statsmodels where gammaln wasn't doing a good job
http://comments.gmane.org/gmane.comp.python.scientific.user/32968

Owner

pv commented Dec 2, 2012

@josef-pkt: if you want the binomial coefficient, you can use scipy.special.binom (will be in Scipy 0.12.0).

betaln is implemented using gammaln

Member

josef-pkt commented Dec 2, 2012

Thanks Pauli, then I'd rather stick with gammaln, or whichever is closer to the formulas in the references.

Owner

pv commented Dec 2, 2012

@josef-pkt: the gammaln formula gives wrong results if |n| >> |x| or |x| >> |n|. PR #370 fixes this in the beta function.

Owner

pv commented Dec 2, 2012

But this PR looks good to me, too.

Owner

rgommers commented Dec 2, 2012

Thanks for having a look. Merging.

rgommers added a commit that referenced this pull request Dec 2, 2012

Merge pull request #371 from rgommers/ticket-1779-nbinom-pmf
BUG: fix precision issue with nbinom.pmf.  Closes ticket 1779.

@rgommers rgommers merged commit 15e9ac0 into scipy:master Dec 2, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment