Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: scipy.stats.Pearson3 ppf function uses right tail probability instead of left #18625

Closed
dmkeijzer opened this issue Jun 4, 2023 · 1 comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected

Comments

@dmkeijzer
Copy link

dmkeijzer commented Jun 4, 2023

Describe your issue.

I had been using the Percent Point Function (ppf) in my optimization code. One of my distributions ended up being a pearson3, when I ended up comparing it to the CDF, the values had a large discrepancy with the ppf function. I proceeded to check the documentation and found the following

image

This however, is not true when I run it in my own environment see below.

Reproducing Code Example

from scipy.stats import pearson3

skew = -2

vals = pearson3.ppf([0.001, 0.5, 0.999], skew)
check = pearson3.cdf(vals, skew)
print(f"check = {check}")
print(f"vals = {vals}")
print(np.allclose([0.001, 0.5, 0.999], check))

Error message

check = [0.999 0.5   0.001]
vals = [ 0.9989995   0.30685282 -5.90775528]
False

SciPy/NumPy/Python version and system information

1.7.3 1.21.5 sys.version_info(major=3, minor=10, micro=4, releaselevel='final', serial=0)
lapack_mkl_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Users/damie/anaconda3/envs/geo\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl', 'C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl\\include', 'C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl\\lib', 'C:/Users/damie/anaconda3/envs/geo\\Library\\include']
lapack_opt_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Users/damie/anaconda3/envs/geo\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl', 'C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl\\include', 'C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl\\lib', 'C:/Users/damie/anaconda3/envs/geo\\Library\\include']
blas_mkl_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Users/damie/anaconda3/envs/geo\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl', 'C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl\\include', 'C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl\\lib', 'C:/Users/damie/anaconda3/envs/geo\\Library\\include']
blas_opt_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Users/damie/anaconda3/envs/geo\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl', 'C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl\\include', 'C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2019.0.117\\windows\\mkl\\lib', 'C:/Users/damie/anaconda3/envs/geo\\Library\\include']
Supported SIMD extensions in this NumPy install:
    baseline = SSE,SSE2,SSE3
    found = SSSE3,SSE41,POPCNT,SSE42,AVX,F16C,FMA3,AVX2
    not found = AVX512F,AVX512CD,AVX512_SKX,AVX512_CLX,AVX512_CNL
@dmkeijzer dmkeijzer added the defect A clear bug or issue that prevents SciPy from being installed or used as expected label Jun 4, 2023
@WarrenWeckesser
Copy link
Member

WarrenWeckesser commented Jun 4, 2023

Thanks for reporting the issue, @dmkeijzer. You are using SciPy version 1.7.3. According to gh-17055, the problem was fixed in version 1.9.2. Your best option is to upgrade your installed version of SciPy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected
Projects
None yet
Development

No branches or pull requests

2 participants