def proportions_ztost(count, nobs, low, upp, prop_var='sample'):
 if (prop_var == 'limits'):
  prop_var_low = low
  prop_var_upp = upp
 elif (prop_var == 'sample'):
  prop_var_low = prop_var_upp = False
 elif (prop_var == 'null'):
  prop_var_low = prop_var_upp = (0.5 * (low + upp))
 elif np.isreal(prop_var):
  prop_var_low = prop_var_upp = prop_var
 tt1 = proportions_ztest(count, nobs, alternative='larger', prop_var=prop_var_low, value=low)
 tt2 = proportions_ztest(count, nobs, alternative='smaller', prop_var=prop_var_upp, value=upp)
 return (np.maximum(tt1[1], tt2[1]), tt1, tt2)

def proportions_ztost ( count , nobs , low , upp , prop_var = 'sample' ) : if ( prop_var == 'limits' ) : prop_var_low = low prop_var_upp = upp elif ( prop_var == 'sample' ) : prop_var_low = prop_var_upp = False elif ( prop_var == 'null' ) : prop_var_low = prop_var_upp = ( 0.5 * ( low + upp ) ) elif np . isreal ( prop_var ) : prop_var_low = prop_var_upp = prop_var tt1 = proportions_ztest ( count , nobs , alternative = 'larger' , prop_var = prop_var_low , value = low ) tt2 = proportions_ztest ( count , nobs , alternative = 'smaller' , prop_var = prop_var_upp , value = upp ) return ( np . maximum ( tt1 [ 1 ] , tt2 [ 1 ] ) , tt1 , tt2 )
equivalence test based on normal distribution parameters count : integer or array_like the number of successes in nobs trials .