statsmodels.stats.rates.etest_poisson_2indep#
- statsmodels.stats.rates.etest_poisson_2indep(count1, exposure1, count2, exposure2, value=None, method='score', compare='ratio', alternative='two-sided', y_grid=None)[source]#
E-test for ratio of two sample Poisson rates
Rates are defined as expected count divided by exposure. The Null and alternative hypothesis for the rates, rate1 and rate2, of two independent Poisson samples are:
for compare = ‘diff’
H0: rate1 - rate2 - value = 0
H1: rate1 - rate2 - value != 0 if alternative = ‘two-sided’
H1: rate1 - rate2 - value > 0 if alternative = ‘larger’
H1: rate1 - rate2 - value < 0 if alternative = ‘smaller’
for compare = ‘ratio’
H0: rate1 / rate2 - value = 0
H1: rate1 / rate2 - value != 0 if alternative = ‘two-sided’
H1: rate1 / rate2 - value > 0 if alternative = ‘larger’
H1: rate1 / rate2 - value < 0 if alternative = ‘smaller’
- Parameters:
- count1
int Number of events in first sample.
- exposure1
float Total exposure (time * subjects) in first sample.
- count2
int Number of events in second sample.
- exposure2
float Total exposure (time * subjects) in second sample.
- value
float Value of the ratio or diff of 2 independent rates under the null hypothesis. Default is equal rates, i.e. 1 for ratio and 0 for diff.
- method{“score”, “wald”}
Method for the test statistic that defines the rejection region.
- compare{‘diff’, ‘ratio’}
Default is “ratio”. If compare is ratio, then the hypothesis test is for the rate ratio defined by ratio = rate1 / rate2. If compare is diff, then the hypothesis test is for diff = rate1 - rate2.
- alternative
str The alternative hypothesis, H1, has to be one of the following
‘two-sided’: H1: ratio of rates is not equal to value (default)
‘larger’ : H1: ratio of rates is larger than value
‘smaller’ : H1: ratio of rates is smaller than value
- y_grid
Noneor 1-Dndarray Grid values for counts of the Poisson distribution used for computing the pvalue. By default truncation is based on an upper tail Poisson quantiles.
- count1
- Returns:
References
Gu, Ng, Tang, Schucany 2008: Testing the Ratio of Two Poisson Rates, Biometrical Journal 50 (2008) 2, 2008 Ng, H. K. T., K. Gu, and M. L. Tang. 2007. “A Comparative Study of Tests for the Difference of Two Poisson Means.” Computational Statistics & Data Analysis 51 (6): 3085-99. https://doi.org/10.1016/j.csda.2006.02.004.