# Confidence interval for success failure ratio?

I need to report the ratio of success to failure with a confidence interval. Assume I have a list of success and failures in the following form:

$$X = [1,0,0,0,0,1,1,1,1,0,0]$$

I need to calculate the win to loss ratio ($$wlr=\frac{p}{1-p}$$) and its confidence interval.

I checked a bootstrapped distribution of it and noticed the distribution is not normal. I have two questions:

• Is there any caveat reporting 0.25-0.975 percentile as my confidence interval?
• Do I need to report the mean or median of this distribution as my point estimate fo wlr?

Here is the code for reference:

def win_loss_ratio(seq,
p_min=0.001):
'''calcuates the odds ratio for a sequence of
0,1 (failure, succcess).

returns an odds ratio'''

p = np.clip(np.mean(seq), p_min, 1 - p_min)
odds = p / (1 - p)
return odds

def bs_replicates(
seq,
func,
samples=1000):
''' calculates a list of bootstrap replicates for
a sequence of success and failures and a replicate function

returns a list of drawed replicates'''

replicates = []
for i in range(samples):
bs_sample = np.random.choice(seq, size=len(seq), replace=True)
rep = func(bs_sample)
replicates.append(rep)
return replicates

def bs_confintv(
seq,
func,
p_min=0.001,
samples=1000,
conf_level=0.95,
):
'''calcuates a confidence interval with a provided confidence interval
returns: average, (lower bound of confidence interval, higher bound of confidence interval)'''

replicates = sorted(bs_replicates(seq, func, samples=samples))
n = len(replicates)
lower_ind = int(n * (1 - conf_level) / 2)
upper_ind = n - lower_ind
return (np.median(replicates), (replicates[lower_ind],
replicates[upper_ind]))

seq = 20* + 200*
bs_confintv(seq, win_loss_ratio)
$$$$
`
• If 0 losses has non-zero probability, the distribution doesn't have a mean... – Glen_b -Reinstate Monica Sep 23 '19 at 5:35