statsmodels.stats.rates.etest_poisson_2indep¶
-
statsmodels.stats.rates.etest_poisson_2indep(count1, exposure1, count2, exposure2, ratio_null=
None
, value=None
, method='score'
, compare='ratio'
, alternative='two-sided'
, ygrid=None
, 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 first sample
- exposure2
float
Total exposure (time * subjects) in first sample
- ratio_null: float
Ratio of the two Poisson rates under the Null hypothesis. Default is 1. Deprecated, use
value
instead.Deprecated since version 0.14.0: Use
value
instead.- 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.
Added in version 0.14.0: Replacement for
ratio_null
.- method{“score”, “wald”}
Method for the test statistic that defines the rejection region.
- alternative
str
The alternative hypothesis, H1, has to be one of the following
‘two-sided’: H1: ratio of rates is not equal to ratio_null (default)
‘larger’ : H1: ratio of rates is larger than ratio_null
‘smaller’ : H1: ratio of rates is smaller than ratio_null
- y_grid
None
or 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.
- ygrid
None
or 1-Dndarray
Same as y_grid. Deprecated. If both y_grid and ygrid are provided, ygrid will be ignored.
Deprecated since version 0.14.0: Use
y_grid
instead.
- 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.