statsmodels.stats.gof.gof_binning_discrete#
- statsmodels.stats.gof.gof_binning_discrete(rvs, distfn, arg, nsupp=20)[source]#
Get bins for chisquare type gof tests for a discrete distribution
- Parameters:
- rvs
ndarray sample data
- distfn
distributioninstance Discrete distribution function to be tested; needs
a,bandcdfattributes/methods.- argsequence
parameters of distribution
- nsupp
int number of bins. The algorithm tries to find bins with equal weights. depending on the distribution, the actual number of bins can be smaller.
- rvs
- Returns:
Notes
The results can be used for a chisquare test
(chis,pval) = stats.chisquare(freq, expfreq)
originally written for scipy.stats test suite, still needs to be checked for standalone usage, insufficient input checking may not run yet (after copy/paste)
- refactor: maybe a class, check returns, or separate binning from
test results
- todo :
optimal number of bins ? (check easyfit), recommendation in literature at least 5 expected observations in each bin