def confidence_interval_dichotomous(point_estimate, sample_size, confidence=0.95, bias=False, percentage=True, **kwargs):
 alpha = ppf(((confidence + 1) / 2), (sample_size - 1))
 p = point_estimate
 if percentage:
  p /= 100
 margin = sqrt(((p * (1 - p)) / sample_size))
 if bias:
  margin += (0.5 / sample_size)
 if percentage:
  margin *= 100
 return ((point_estimate - (alpha * margin)), (point_estimate + (alpha * margin)))

def confidence_interval_dichotomous ( point_estimate , sample_size , confidence = 0.95 , bias = False , percentage = True , ** kwargs ) : alpha = ppf ( ( ( confidence + 1 ) / 2 ) , ( sample_size - 1 ) ) p = point_estimate if percentage : p /= 100 margin = sqrt ( ( ( p * ( 1 - p ) ) / sample_size ) ) if bias : margin += ( 0.5 / sample_size ) if percentage : margin *= 100 return ( ( point_estimate - ( alpha * margin ) ) , ( point_estimate + ( alpha * margin ) ) )
dichotomous confidence interval from sample size and maybe a bias .