You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am implementing Levy's alpha-stable distribution for the JAX framework, using scipy as reference and I found some discrepancies.
The tail values of scipy's levy_stable.logpdf are incorrect for alpha in (1,2], beta in {-1, +1} and |x| >= 10. In particular, they do not obey the expected exponential law.
My suggestion to resolve this issue would be to bypass the quadrature-based implementation in C for |beta| == 1 and to directly implement the tail approximation as in `levy-stable-jax1. Happy to discuss a possible PR.
lucascolley
changed the title
BUG: incorrect logpdf values in scipy.stats.levy_stable for beta == +-1
BUG: stats.levy_stable: incorrect logpdf values for beta == +-1
May 5, 2024
Describe your issue.
Hello,
I am implementing Levy's alpha-stable distribution for the JAX framework, using scipy as reference and I found some discrepancies.
The tail values of scipy's
levy_stable.logpdf
are incorrect for alpha in (1,2], beta in {-1, +1} and |x| >= 10. In particular, they do not obey the expected exponential law.See Nolan (2020), Proposition 3.1 page 100 for the correct tail approximation. I have implemented it (in jax) here:
https://github.com/tjhunter/levy-stable-jax/blob/b3e3e05cc572b68742a8d1f0223fd88230836f30/src/levy_stable_jax/distribution.py#L169
Here is an example. In blue is the theoretical tail behaviour (implemented by levy-stable-jax), in orange scipy
Link to the notebook that created the plot:
https://github.com/tjhunter/levy-stable-jax/blob/main/notebooks/scipy_issues.ipynb
My suggestion to resolve this issue would be to bypass the quadrature-based implementation in C for |beta| == 1 and to directly implement the tail approximation as in `levy-stable-jax1. Happy to discuss a possible PR.
Reproducing Code Example
Error message
SciPy/NumPy/Python version and system information
The text was updated successfully, but these errors were encountered: