- statsmodels.stats.proportion.power_proportions_2indep(diff, prop2, nobs1, ratio=1, alpha=0.05, value=0, alternative='two-sided', return_results=True)¶
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
difference between proportion 1 and 2 under the alternative
proportion for the reference case, prop2, proportions for the first case will be computed using p2 and diff p1 = p2 + diff
number of observations in sample 1
sample size ratio, nobs2 = ratio * nobs1
Significance level, e.g. 0.05, is the probability of a type I error, that is wrong rejections if the Null Hypothesis is true.
currently only value=0, i.e. equality testing, is supported
str, ‘two-sided’ (
default), ‘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’.
If true, then a results instance with extra information is returned, otherwise only the computed power is returned.
If return_results is True, then a results instance with the information in attributes is returned. If return_results is False, then only the power is returned.
Power of the test, e.g. 0.8, is one minus the probability of a type II error. Power is the probability that the test correctly rejects the Null Hypothesis if the Alternative Hypothesis is true.
Other attributes in results instance include :
pooled proportion, used for std_null
standard error of difference under the null hypothesis (without sqrt(nobs1))
standard error of difference under the alternative hypothesis (without sqrt(nobs1))