statsmodels.stats.rates.power_equivalence_neginb_2indep#
- statsmodels.stats.rates.power_equivalence_neginb_2indep(rate1, rate2, nobs1, low, upp, nobs_ratio=1, exposure=1, alpha=0.05, dispersion=0, method_var='alt', return_results=False)[source]#
Power of equivalence test of ratio of 2 indep. negative binomial 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
floator array_like Number of observations in sample 1.
- low
floator array_like Lower equivalence margin for the rate ratio, rate1 / rate2.
- upp
floator array_like Upper equivalence margin for the rate ratio, rate1 / rate2.
- nobs_ratio
floator array_like,optional Sample size ratio, nobs2 = nobs_ratio * nobs1. All values must be positive and finite.
Changed in version 0.15.1: A nobs_ratio that is not positive and finite raises a
ValueError. Previously it returned nan or raised aZeroDivisionError.- exposure
float,optional Exposure for each observation. Total exposure is nobs1 * exposure and nobs2 * exposure.
- alpha
floator array_likeininterval(0,1),optional Significance level, e.g., 0.05, is the probability of a type I error, that is wrong rejections if the Null Hypothesis is true.
- dispersion
floator array_like >= 0.,optional Dispersion parameter for Negative Binomial distribution. The Poisson limiting case corresponds to
dispersion=0.- method_var{“score”, “alt”, “ftotal”},
optional 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", or based on a moment constrained estimate,method_var="ftotal". see references.- return_resultsbool,
optional If true, then a results instance with extra information is returned, otherwise only the computed power is returned.
- rate1
- Returns:
PowerEquivalenceResultorfloatIf return_results is False (default), then only the power is returned as a float. If return_results is True, then a
PowerEquivalenceResultresult object is returned; it behaves like the scalar power in numeric comparisons (e.g.assert_allclose), while also exposing std_null_low, std_null_upp, std_alt and other attributes.
Notes
Changed in version 0.15.1: The power is changed if
nobs_ratiois not equal to 1. The variances of the test statistic used the wrong sample size and, formethod_var="alt", the rates of the two samples were interchanged. Formethod_var="ftotal"the variance under the null hypothesis used the wrong sample size ratio; withdispersion=0it is now equal tomethod_var="score". Results fornobs_ratio=1are unchanged.References
[1]Zhu, Haiyuan. 2017. “Sample Size Calculation for Comparing Two Poisson or Negative Binomial Rates in Noninferiority or Equivalence Trials.” Statistics in Biopharmaceutical Research, March. https://doi.org/10.1080/19466315.2016.1225594
[2]Zhu, Haiyuan, and Hassan Lakkis. 2014. “Sample Size Calculation for Comparing Two Negative Binomial Rates.” Statistics in Medicine 33 (3): 376-87. https://doi.org/10.1002/sim.5947.
[3]PASS documentation