statsmodels.stats.rates.confint_poisson

statsmodels.stats.rates.confint_poisson(count, exposure, method=None, alpha=0.05)[source]

Confidence interval for a Poisson mean or rate

The function is vectorized for all methods except “midp-c”, which uses an iterative method to invert the hypothesis test function.

All current methods are central, that is the probability of each tail is smaller or equal to alpha / 2. The one-sided interval limits can be obtained by doubling alpha.

Parameters:
count : array_like

Observed count, number of events.

exposure : arrat_like

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

method : str

Method to use for confidence interval This is required, there is currently no default method

alpha : float in (0, 1)

Significance level, nominal coverage of the confidence interval is 1 - alpha.

Returns:

tuple (low, upp)

Return type:

confidence limits.

Notes

Methods are mainly based on Barker (2002) [1] and Swift (2009) [3].

Available methods are:

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

  • “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.

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

  • “jeffreys” : based on Jeffreys’ prior. computed using gamma distribution

  • “sqrt” : based on square root transformed counts

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

  • “sqrt-centcc” will likely be dropped. anscombe with continuity corrected center. (Similar to R survival cipoisson, but without the 3/8 right shift of the confidence interval).

sqrt-cent is the same as sqrt-a, using a different computation, will be deleted.

sqrt-v is a corrected square root method attributed to vandenbrouke, which might also be deleted.

Todo:

  • missing dispersion,

  • maybe split nobs and exposure (? needed in NB). Exposure could be used to standardize rate.

  • modified wald, switch method if count=0.

See also

test_poisson

References