Repository navigation
Description
Describe the bug
statsmodels.stats.proportion.multinomial_proportions_confint fails with method="sison-glaz" for degenerate data. Goodman still gives a result.
When method == 'sison-glaz', if for some reason c cannot be computed; this signals a bug and should be reported.
hence this report
Code Sample, a copy-pastable example if possible
import statsmodels.stats.proportion
statsmodels.stats.proportion.multinomial_proportions_confint(
[6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], method="sison-glaz")Other arrays that fail:
[4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
[2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
Using version 0.14.4
Expected Output
A result roughly similar to goodman.
Output of import statsmodels.api as sm; sm.show_versions()
Details
INSTALLED VERSIONS
Python: 3.11.13.final.0
OS: Linux 6.1.123+ #1 SMP PREEMPT_DYNAMIC Sun Mar 30 16:01:29 UTC 2025 x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
statsmodels
Installed: 0.14.4 (/usr/local/lib/python3.11/dist-packages/statsmodels)
Required Dependencies
cython: 3.0.12 (/usr/local/lib/python3.11/dist-packages/Cython)
numpy: 2.0.2 (/usr/local/lib/python3.11/dist-packages/numpy)
scipy: 1.15.3 (/usr/local/lib/python3.11/dist-packages/scipy)
pandas: 2.2.2 (/usr/local/lib/python3.11/dist-packages/pandas)
dateutil: 2.9.0.post0 (/usr/local/lib/python3.11/dist-packages/dateutil)
patsy: 1.0.1 (/usr/local/lib/python3.11/dist-packages/patsy)
Optional Dependencies
matplotlib: 3.10.0 (/usr/local/lib/python3.11/dist-packages/matplotlib)
backend: module://matplotlib_inline.backend_inline
cvxopt: 1.3.2 (/usr/local/lib/python3.11/dist-packages/cvxopt)
joblib: 1.5.1 (/usr/local/lib/python3.11/dist-packages/joblib)
Developer Tools
IPython: 7.34.0 (/usr/local/lib/python3.11/dist-packages/IPython)
jinja2: 3.1.6 (/usr/local/lib/python3.11/dist-packages/jinja2)
sphinx: 8.2.3 (/usr/local/lib/python3.11/dist-packages/sphinx)
pygments: 2.19.2 (/usr/local/lib/python3.11/dist-packages/pygments)
pytest: 8.3.5 (/usr/local/lib/python3.11/dist-packages/pytest)
virtualenv: Not installed
Activity
josef-pkt commentedon Jul 16, 2025
My guess is that this is a limitation of the method. (Too many zeros.)
But I need to check this when I have time again. (I'm currently on vacation and travelling.)
josef-pkt commentedon Jul 16, 2025
Brief look at example and code:
docstring says
"In
their paper, Sison & Glaz demo their method with at least 7 categories, so
len(counts) >= 7with all values incountsat or above 5 can be usedas a rule of thumb for the validity of this method.
"
Based on this the Sison-Glaz confidence interval would not be a good approximation to a "true" interval.
Second, based on my brief look at the method, I don't see what the minimum requirement for the existence of the Sison-Glaz confint is. (It has been a long time since I looked at those details.)
The following example works
statsmodels.stats.proportion.multinomial_proportions_confint( [60, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0], method="sison-glaz")So, technically the method seems to require a larger number of overall counts and can handle the zeros.
The results even look reasonable
and narrower confint than goodman
I guess, there will not be a way to get around the non-existence of the Sison-Glaz interval if the counts are too small.
(Similar to other cases where we need a minimum number of observations or counts for a method to produce numerically valid results.)
shipitdev commentedon Jun 10, 2026
Hey @josef-pkt ,
I dug into the implementation in
statsmodels/stats/proportion.py. Since this is an inherent mathematical and sample-size limitation of the Sison-Glaz (as you noted above) raising a genericExceptionmakes it look like an unexpected bug. I'd love to take this up and refactor it to throw a clean, descriptiveValueErrorexplaining the convergence limitation. If that sounds good i'd love to work on thisTEST: add R MultinomialCI reference values for a sparse sison-glaz ca…
BUG: Fix sison-glaz confint failure for small or sparse counts
TEST: add R MultinomialCI reference values for a sparse sison-glaz ca…