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:
countarray_like

Observed count, number of events.

exposurearrat_like

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

methodstr

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

alphafloat in (0, 1)

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

Returns:
tuple (low, upp)confidence limits.

See also

test_poisson

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.

References

[1]

Barker, Lawrence. 2002. “A Comparison of Nine Confidence Intervals for a Poisson Parameter When the Expected Number of Events Is ≤ 5.” The American Statistician 56 (2): 85–89. https://doi.org/10.1198/000313002317572736.

[2]

Patil, VV, and HV Kulkarni. 2012. “Comparison of Confidence Intervals for the Poisson Mean: Some New Aspects.” REVSTAT–Statistical Journal 10(2): 211–27.

[3]

Swift, Michael Bruce. 2009. “Comparison of Confidence Intervals for a Poisson Mean – Further Considerations.” Communications in Statistics - Theory and Methods 38 (5): 748–59. https://doi.org/10.1080/03610920802255856.


Last update: Mar 18, 2024