statsmodels.stats.proportion.power_proportions_2indep#

statsmodels.stats.proportion.power_proportions_2indep(diff, prop2, nobs1, ratio=1, alpha=0.05, value=0, alternative='two-sided', return_results=True)[source]#

Power for ztest that two independent proportions are equal

This assumes that the variance is based on the pooled proportion under the null and the non-pooled variance under the alternative

Parameters:
difffloat

difference between proportion 1 and 2 under the alternative

prop2float

proportion for the reference case, prop2, proportions for the first case will be computed using p2 and diff p1 = p2 + diff

nobs1float or int

number of observations in sample 1

ratiofloat, optional

sample size ratio, nobs2 = ratio * nobs1

alphafloat in interval (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.

valuefloat, optional

currently only value=0, i.e., equality testing, is supported

alternative{‘two-sided’, ‘larger’, ‘smaller’}, optional

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, optional

If true, then a results instance with extra information is returned, otherwise only the computed power is returned.

Returns:
PowerProportionsResult or float

If return_results is True (default), then a PowerProportionsResult namedtuple is returned. If return_results is False, then only the power is returned as a float.