jax icon indicating copy to clipboard operation
jax copied to clipboard

betabinom.pmf and logpmf give wrong values for negative or non-whole-number loc

Open mottopanikeiku opened this issue 1 month ago • 1 comments

jax.scipy.stats.betabinom.pmf and logpmf seem to give wrong values when loc is set negative or not as a whole number, although this doesnt happen with positive whole-number loc. i've identified the cause and fixed it its quite simple

import jax, jax.numpy as jnp, numpy as np
from scipy import stats
jax.config.update("jax_enable_x64", True)
k = np.arange(5.0) - 2
print(stats.betabinom.pmf(k, 4, 2, 3, loc=-2))
print(jax.scipy.stats.betabinom.pmf(jnp.asarray(k), 4, 2, 3, loc=-2))
[0.21428571 0.28571429 0.25714286 0.17142857 0.07142857]
[0.         0.         0.25714286 0.17142857 0.07142857]

jax 0.11.2, jaxlib 0.11.2, scipy 1.18.1, python 3.12, cpu (linux)

I made this report and directed the investigation, with AI assistance from Claude and GPT-6 Astra.

mottopanikeiku avatar Oct 19 '26 07:10 mottopanikeiku

Fixed by #41788

jakevdp avatar Dec 02 '26 02:12 jakevdp