# Thread: Confidence Intervals of Ratios

1. ## Confidence Intervals of Ratios

Hello,
I'm a PhD student and I'm a little embarrassed to be asking for Maths help on here, but there is something I couldn't find out by googling, so I figured I'll ask here.

I have been running two sets of experiments, the first is a base line, and the second is hopefully an improvement on the first. I repeat each experiment many times and get a set of values, for example:

first = ( 2, 3, 3, 2, 4, 2 ) mean = 2.67, stddev = 0.82, 95% interval = +/- 0.65
second = (4, 5, 6, 5, 4, 5 ) mean = 4.83, stddev = 0.75, 95% interval = +/- 0.6

Now I can work out a 95% confidence interval for both sets of values. In my report I've been writing that the first experiment on average is 2.67 +/- 0.65, and the second is 4.83 +/- 0.6. Thus the second experiment produces values 1.81 (4.83/2.67) higher (and better) than the first experiment. However I do not know what the confidence intervals would be on this (1.81) value.

I had thought I could divide the intervals together for example the first min value divided by the second's min value. But I have a feeling this isn't right.

Hopefully this has explained my problem, and that someone is able to help.
Thanks
Andrew

P.S These are not the real values from my experiment and some I just made up, but I hopefully want to work out the confidence intervals for both discrete and continuous data.

2. If you compile the two data sets into one by using a ratio, then I suggest calculating a new standard deviation and sample mean. After you have that, you can then find your confidence intervals for whatever alpha you choose.

Good question:

3. wow thanks for the quick reply.

Could you give me a quick example of what you mean with my data?

thank you
Andrew

4. Originally Posted by bramp
wow thanks for the quick reply.

Could you give me a quick example of what you mean with my data?

thank you
Andrew
first = ( 2, 3, 3, 2, 4, 2 ) mean = 2.67, stddev = 0.82, 95% interval = +/- 0.65
second = (4, 5, 6, 5, 4, 5 ) mean = 4.83, stddev = 0.75, 95% interval = +/- 0.6

You want to use ratios, correct?

New Data Set = (0.5, 0.6, 0.4, 1, 0.4), Mean = 0.566666667, StDev = 0.225092574

If you simply did ratios of the separate means and standard deviations, then you would get different results, specifically: Mean = 0.551724138, StDev = 1.084652289

5. Originally Posted by colby2152
New Data Set = (0.5, 0.6, 0.4, 1, 0.4), Mean = 0.566666667, StDev = 0.225092574
Ok I see you took the first value from each set, work out the ratio, and continued with the second value and so on.

However I might have not been clear. The first value in my set does not have to directly map to the first value of the second set. So for example if I sorted my data sets:

first = ( 2, 2, 2, 3, 3, 4 ) mean = 2.67, stddev = 0.82, 95% interval = +/- 0.65
second = (4, 4, 5, 5, 5, 6) mean = 4.83, stddev = 0.75, 95% interval = +/- 0.6

Their means etc are still the same, however using your method the new data set would be:
(0.5, 0.5, 0.4, 0.6, 0.6, 0.666666667) Mean = 0.544444444, StDev = 0.095839372
and thus give me a different mean/stdev to the results being unordered.

I may be wrong, but I'm unsure if your method works.

If it helps I can give details of my experiment. I am running a network simulator that simulates packets flowing through a network. Now I've written a new network protocol that aims at improving the network some how. So I run different tests using a randomly generated workload with the old and new protocols and measure the number of packets generated.

Now I run each experiment multiple times and at the end I have a mean number of packets for the old protocol experiments, and a mean number of packets for the new protocol experiments. I can then simply say that the new protocol has mean1 / mean2 more packets on average, but I would like the confidence intervals for that value.

thanks

6. Okay, so the data points are not correlated. I need some more information... are these small or large samples?

If small, use the following for a confidence interval:

$\bar{x}-\bar{y} \pm t_{\alpha/2}(n+m-2)s_p\sqrt{\frac{1}{n}+\frac{1}{m}}$

where: $s_p = \sqrt{\frac{(n-1)s_x^2+(m-1)s_y^2}{n+m-2}}$

If large, you can use the less cumbersome confidence interval:

$\bar{x}-\bar{y} \pm z_{\alpha/2}\sqrt{\frac{s^2_x}{n}+\frac{s^2_y}{m}}$

$n, m$ are the sample sizes of the data sets where $\bar{x}, \bar{y}$ are the respected sample means, and $s^2_x, s^2_y$ are the respected sample standard deviations.

In these cases, you would use the sample means and standard deviations that you first calculated seperately.

7. Thanks for all the help, but I have now found the solution here:

What I needed to use was the Fieller's method to work out the confidence intervals.

thanks
Andrew

8. Originally Posted by bramp
Hello,
I'm a PhD student and I'm a little embarrassed to be asking for Maths help on here, but there is something I couldn't find out by googling, so I figured I'll ask here.

I have been running two sets of experiments, the first is a base line, and the second is hopefully an improvement on the first. I repeat each experiment many times and get a set of values, for example:

first = ( 2, 3, 3, 2, 4, 2 ) mean = 2.67, stddev = 0.82, 95% interval = +/- 0.65
second = (4, 5, 6, 5, 4, 5 ) mean = 4.83, stddev = 0.75, 95% interval = +/- 0.6

Now I can work out a 95% confidence interval for both sets of values. In my report I've been writing that the first experiment on average is 2.67 +/- 0.65, and the second is 4.83 +/- 0.6. Thus the second experiment produces values 1.81 (4.83/2.67) higher (and better) than the first experiment. However I do not know what the confidence intervals would be on this (1.81) value.

I had thought I could divide the intervals together for example the first min value divided by the second's min value. But I have a feeling this isn't right.

Hopefully this has explained my problem, and that someone is able to help.
Thanks
Andrew

P.S These are not the real values from my experiment and some I just made up, but I hopefully want to work out the confidence intervals for both discrete and continuous data.
Consider computing a bootstrap confidence interval (google for bootstrap)

You construct a sample of the ratio of mean where the means are
constructed by resampling from the samples with replacement.

RonL