statsmodels.stats.rates.power_poisson_diff_2indep#
- statsmodels.stats.rates.power_poisson_diff_2indep(rate1, rate2, nobs1, nobs_ratio=1, alpha=0.05, value=0, method_var='score', alternative='two-sided', return_results=True)[source]#
Power of ztest for the difference between two independent poisson rates
- Parameters:
- rate1
float Poisson rate for the first sample, treatment group, under the alternative hypothesis.
- rate2
float Poisson rate for the second sample, reference group, under the alternative hypothesis.
- nobs1
floatorint Number of observations in sample 1.
- nobs_ratio
float Sample size ratio, nobs2 = nobs_ratio * nobs1.
- alpha
floatininterval(0,1) Significance level, e.g., 0.05, is the probability of a type I error, that is wrong rejections if the Null Hypothesis is true.
- value
float Difference between rates 1 and 2 under the null hypothesis.
- method_var{“score”, “alt”}
The variance of the test statistic for the null hypothesis given the rates under the alternative, can be either equal to the rates under the alternative
method_var="alt", or estimated under the constrained of the null hypothesis,method_var="score".- alternative{‘two-sided’, ‘larger’, ‘smaller’}
Alternative hypothesis whether the power is calculated for a two-sided (default) or one sided test. The one-sided test can be either ‘larger’, ‘smaller’.
- return_resultsbool
If true, then a results instance with extra information is returned, otherwise only the computed power is returned.
- rate1
- Returns:
PowerDiffResultorfloatIf return_results is False, then only the power is returned as a float. If return_results is True (default), then a
PowerDiffResultresult object is returned; it behaves like the scalar power in numeric comparisons (e.g.,assert_allclose), while also exposing std_null, std_alt and other attributes.
References
[1]Stucke, Kathrin, and Meinhard Kieser. 2013. “Sample Size Calculations for Noninferiority Trials with Poisson Distributed Count Data.” Biometrical Journal 55 (2): 203-16. https://doi.org/10.1002/bimj.201200142.
[2]PASS manual chapter 436