statsmodels.stats.proportion.power_ztost_prop

statsmodels.stats.proportion.power_ztost_prop(low, upp, nobs, p_alt, alpha=0.05, dist='norm', variance_prop=None, discrete=True, continuity=0, critval_continuity=0)[source]

Power of proportions equivalence test based on normal distribution

Parameters
low, uppfloats

lower and upper limit of equivalence region

nobsint

number of observations

p_altfloat in (0,1)

proportion under the alternative

alphafloat in (0,1)

significance level of the test

diststring in [‘norm’, ‘binom’]

This defines the distribution to evalute the power of the test. The critical values of the TOST test are always based on the normal approximation, but the distribution for the power can be either the normal (default) or the binomial (exact) distribution.

variance_propNone or float in (0,1)

If this is None, then the variances for the two one sided tests are based on the proportions equal to the equivalence limits. If variance_prop is given, then it is used to calculate the variance for the TOST statistics. If this is based on an sample, then the estimated proportion can be used.

discretebool

If true, then the critical values of the rejection region are converted to integers. If dist is “binom”, this is automatically assumed. If discrete is false, then the TOST critical values are used as floating point numbers, and the power is calculated based on the rejection region that is not discretized.

continuitybool or float

adjust the rejection region for the normal power probability. This has and effect only if dist='norm'

critval_continuitybool or float

If this is non-zero, then the critical values of the tost rejection region are adjusted before converting to integers. This affects both distributions, dist='norm' and dist='binom'.

Returns
powerfloat

statistical power of the equivalence test.

(k_low, k_upp, z_low, z_upp)tuple of floats

critical limits in intermediate steps temporary return, will be changed

Notes

In small samples the power for the discrete version, has a sawtooth pattern as a function of the number of observations. As a consequence, small changes in the number of observations or in the normal approximation can have a large effect on the power.

continuity and critval_continuity are added to match some results of PASS, and are mainly to investigate the sensitivity of the ztost power to small changes in the rejection region. From my interpretation of the equations in the SAS manual, both are zero in SAS.

works vectorized

verification:

The dist='binom' results match PASS, The dist='norm' results look reasonable, but no benchmark is available.

References

SAS Manual: Chapter 68: The Power Procedure, Computational Resources PASS Chapter 110: Equivalence Tests for One Proportion.