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

stats/proportion.py's binom_test_reject_interval function's error #9238

Open
wolyosung opened this issue May 1, 2024 · 2 comments
Open

stats/proportion.py's binom_test_reject_interval function's error #9238

wolyosung opened this issue May 1, 2024 · 2 comments

Comments

@wolyosung
Copy link

Describe the bug

from version 0.13.5 to 0.14.x, there is change in stats/proportion.py 's binom_test_reject_interval's return value.
now it is set to be an integer mandatorily,whereas it did not specify any type before.
However, scipy's stats.binom.ppf and isf function do not guarantee the value to be integer.

especially, ppf and isf function's output is np.full(shape(cond), fill_value=self.badvalue, dtype='d')
as badvalue is set to be np.nan as default, so if output.ndim == 0:, then output[()] can be float(nan).

therefore, x_low and x_upp can receive the nan value.
is it an intended behavior? could you please check the issue?

Code Sample, a copy-pastable example if possible

# Your code here that produces the bug
# This example should be self-contained, and so not rely on external data.
# It should run in a fresh ipython session, and so include all relevant imports.

Note: As you can see, there are many issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates.

Note: Please be sure you are using the latest released version of statsmodels, or a recent build of main. If your problem has been fixed in an unreleased version, you might be able to use main until a new release occurs.

Note: If you are using a released version, have you verified that the bug exists in the main branch of this repository? It helps the limited resources if we know problems exist in the current main branch so that they do not need to check whether the code sample produces a bug in the next release.

If the issue has not been resolved, please file it in the issue tracker.

Expected Output

A clear and concise description of what you expected to happen.

Output of import statsmodels.api as sm; sm.show_versions()

[paste the output of import statsmodels.api as sm; sm.show_versions() here below this line]

@josef-pkt
Copy link
Member

Do you have an example that returned nan?

Right now I don't remember and don't understand how boundary cases are supposed to be handled.

@josef-pkt
Copy link
Member

misleading docstring

binom_test_reject_interval is not for the current (scipy) binom_test in the two-sided case.
scipy binom test is minlike, while binom_test_reject_interval is for equal-tail binomtest
e.g #2735 #8233

I don't see any internal use of binom_test_reject_interval
The tost rejection interval is used in computing exact power in power_binom_tost, AFAICS.
But there is no version for the test case.

Aside: I guess the int casting also breaks the usage for vectorized calls.
But for the minlike intervals, we don't have vectorized solution anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants