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
{{ message }}
Repository navigation
Check sum is 1 using np.isclose instead of == in powerdiscrepancy #8558
powerdiscrepancy checks if sum of expected equals (==) to n or 1, but should probably check if the sum is np.isclose or np.allclose to avoid throwing an error (see below) when the sum is 0.9999999.
Error thrown is:
ValueError: observed and expected need to have the same number of observations, or e needs to add to 1
from line 153 of statsmodels/stats/gof.py
I changed the code in line 147 to if np.allclose(np.sum(e, axis=axis), n):
and in line 149 to elif np.allclose(np.sum(e, axis=axis), 1):
and then it works fine.
Activity
josef-pkt commentedon Dec 8, 2022
scipy uses rtol=1e-8 on powerdiscrepancy/chisquare
josef-pkt commentedon Dec 9, 2022
fixed in #8567
@yoavram Thanks for the issue