statsmodels.stats.gof.gof_chisquare_discrete#
- statsmodels.stats.gof.gof_chisquare_discrete(distfn, arg, rvs, alpha, msg)[source]#
Perform chisquare test for random sample of a discrete distribution
- Parameters:
- distfn
distributioninstance Discrete distribution function to be tested; needs
support,ppfandcdfmethods.- argsequence
parameters of distribution
- rvsarray_like
random sample from the distribution to be tested
- alpha
float significance level, threshold for p-value
- msg
str identifying message that is included in the returned result string
- distfn
- Returns:
Notes
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)
The bins are computed by
gof_binning_discretewith its default number of bins. Observations outside the support of the distribution are dropped. The last bin can have a very small expected count, which makes the chisquare approximation of the p-value unreliable.Changed in version 0.15.1: The support of the distribution is taken from
distfn.support(*arg)instead of a fixed window of integers from -1000 to 1000. The bins now follow loc shifts and large means.- refactor: maybe a class, check returns, or separate binning from
test results