statsmodels.stats.rates.test_poisson#

statsmodels.stats.rates.test_poisson(count, nobs, value, method=None, alternative='two-sided', dispersion=1)[source]#

Test for one sample poisson mean or rate

Parameters:
countarray_like

Observed count, number of events.

nobsarray_like

Currently this is total exposure time of the count variable. This will likely change.

valuefloat or array_like

This is the value of poisson rate under the null hypothesis.

methodstr, optional

Method to use for the hypothesis test. This is required, there is currently no default method. See Notes for available methods.

alternative{‘two-sided’, ‘smaller’, ‘larger’}, optional

Alternative hypothesis, which can be two-sided or either one of the one-sided tests.

dispersionfloat, optional

Dispersion scale coefficient for Poisson QMLE. Default is that the data follows a Poisson distribution. Dispersion different from 1 corresponds to excess-dispersion in Poisson quasi-likelihood (GLM). Dispersion coefficient different from one is currently only used in wald and score method.

Returns:
PoissonTestResult

Result object with test statistic, pvalue and other attributes.

See also

confint_poisson

Notes

The implementation of the hypothesis test is mainly based on the references for the confidence interval, see confint_poisson.

Available methods are:

  • “score” : based on score test, uses variance under null value

  • “wald” : based on wald test, uses variance base on estimated rate.

  • “waldccv” : based on wald test with 0.5 count added to variance computation. This does not use continuity correction for the center of the confidence interval.

  • “exact-c” central confidence interval based on gamma distribution

  • “midp-c” : based on midp correction of central exact confidence interval. this uses numerical inversion of the test function. not vectorized.

  • “sqrt” : based on square root transformed counts

  • “sqrt-a” based on Anscombe square root transformation of counts + 3/8.

  • “sqrt-v” based on Vandenbroucke square root transformation of counts.