-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats
Milestone
Description
Describe your issue.
When trying to get moments estimation (mean, variance, skewness, kurtosis) for Johnson SU distributions parametrized with specific location, scale, a and b values, the function fails to converge.
Tried to increase the limit from 50 to 100 as suggested from the error message, with no result.
From a quick look at _distn_infrastructure.py, the culprit should be the part where the ppf is integrated, especially when it contains high steepness near the boundaries (singularities). It can be mitigated by changing the integration boundaries in _distn_infrastructure.py:2041 from (0, 1) to (0.00000001, 0.9999999). This however changes the integration result.
Reproducing Code Example
from scipy.stats import johnsonsu
l= 0.02; s= 0.0001; a = -0.01; b = 1.1
mean, var, skew, kurt = johnsonsu.stats(a, b, loc=l, scale=s, moments='mvsk')
Error message
IntegrationWarning: The maximum number of subdivisions (50) has been achieved.
If increasing the limit yields no improvement it is advised to analyze
the integrand in order to determine the difficulties. If the position of a
local difficulty can be determined (singularity, discontinuity) one will
probably gain from splitting up the interval and calling the integrator
on the subranges. Perhaps a special-purpose integrator should be used.
return integrate.quad(self._mom_integ1, 0, 1, args=(m,)+args)[0]
SciPy/NumPy/Python version information
1.10.1 1.22.3 sys.version_info(major=3, minor=10, micro=1, releaselevel='final', serial=0)
Metadata
Metadata
Assignees
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats