Power of proportions equivalence test based on normal distribution
Parameters:  low, upp : floats
nobs : int
p_alt : float in (0,1)
alpha : float in (0,1)
dist : string in [‘norm’, ‘binom’]
variance_prop : None or float in (0,1)
discrete : bool
continuity : bool or float
critval_continuity : bool or float


Returns:  power : float
(k_low, k_upp, z_low, z_upp) : tuple of floats

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.