# Comparing two ratios with tolerances

I'm trying to figure out what the most robust way to compare two ratios is. What I have is a set of proportions between two or more quantities. For example, it might be 0.5:0.5, or 0.45:0.2:0.35. Then I have some measurements of those quantities, for example, I might have 47, 21, 32. What I'm doing is converting those quantities into proportions (so in this case it'll be 0.47, 0.21 and 0.32 - i.e. they add up to 1) and then comparing it to the expected ratio (0.45:0.2:0.35).

0.47:0.21:0.32 is probably close enough to 0.45:0.2:0.35, but what's the best equation for comparing these with an adjustable tolerance?

What I'm currently doing is to take each number in my observed ratio and dividing it by the expected value. Then if the result is within the range of 0.9...1.1, I'm saying it's close enough. Then if all numbers are within this range, then the ratio is close enough. However, the weakness here is that the smallest number in the ratio (in my example, the 0.20) ends up being the most important since it'll end up with the tightest range.

Is there an established way to do this kind of comparison?

-

Welcome to Math.SE! You define the distance between two triples $(a,b,c)$ and $(a',b',c')$ as the maximum of $a/a', a'/a, b/b', b'/b, c/c', c'/c$, minus $1$. (If this distance is less than $0.1$, it's "small enough" for you.) A conceptually similar, but a more elegant (mathematically) method is to use $\max (|\ln a-\ln a'|, |\ln b-\ln b'|, |\ln c-\ln c'|)$ as the distance. This also puts emphasis on smaller numbers (since the logarithm changes rapidly near $0$), but not quite as much as your approach.

One way to avoid emphasizing small components of the ratio at all is to simply take the maximum of differences like $|0.47-0.45|$, etc.

Ultimately, the choice depends on the nature of your data and what you want to do with it. For example, for the pairs $0.95:0.05$ and $0.96:0.04$ the methods give the following distances:

• $0.05/0.04-1=0.25$ if you use ratios,
• $\ln 0.05-\ln 0.04 = 0.22$ if you use logarithms
• $0.01$ if you use differences.

Which one fits your idea of "being close" the best?

Remark: you can help stats.SE to accumulate questions (hence, graduate from beta sooner) by posing your question there. (Hopefully, with a little more detail about what you want this comparison to achieve).

-
Thanks. That helps a lot. I'll have to play around with some sample data to decide which works best. –  user58636 Jan 17 '13 at 19:56