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

Merged
merged 1 commit into from Dec 2, 2012

3 participants

@rgommers
SciPy member

No description provided.

@josef-pkt
SciPy member

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

@pv
SciPy member
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

@josef-pkt
SciPy member

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

@pv
SciPy member
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.

@pv
SciPy member
pv commented Dec 2, 2012

But this PR looks good to me, too.

@rgommers
SciPy member

Thanks for having a look. Merging.

@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