BigHands79
BigHands79

Reputation: 249

Stats - Weighted Difference?

I have a stats problem I'm trying to solve that I know has been solved before, but unfortunately I don't know what to search for. Here's what I'd like to do:

I would like to take the difference between two numbers, but have the result vary depending on the scale of the numbers.

For example, (58 - 56 = 2) and (100002 - 100000 = 2).

In the first equation, the difference of "2" holds more significance than the second equation because the scale of the numbers is smaller. My immediate reaction is to build an non-linear equation to map results onto it, but I'd like to research a "proper" solution first.

Does this have a name? Can anyone point me in the right direction?

Thanks!

Edit; Solution: MvG's suggestion of relative difference did the trick. The specific problem I was trying to solve was the difference in network speed. So (58kbps - 56kbps = 2kbps) is a much more significant difference than (10000002kbps - 10000000kbps = 2kbps). This solves the particular problem I was trying to solve. Thanks all!

Upvotes: 2

Views: 3624

Answers (1)

MvG
MvG

Reputation: 60868

I'd call this a relative difference. In some cases, the term relative error would be appropriate as well.

As the Wikipedia article correctly states, there is no unique definition of a relative difference. Common symmetric solutions (not exactly as listed on Wikipedia, but with my own intuition thrown in) include

(A-B)/abs((A + B)/2)        # average value as reference
(A-B)/((abs(A) + abs(B))/2) # average magnitude as reference
(A-B)/max(abs(A), abs(B))   # greater magnitude as reference
(A-B)/min(abs(A), abs(B))   # smaller magnitude as reference
(A-B)/abs(max(A, B))        # greater value as reference
(A-B)/abs(min(A, B))        # smaller value as reference

If your two values are not of the same kind, e.g. one is the expected and the other the observed value, then it might make sense to use one of them as reference, thus leading to a relative change instead of a relative difference. This is not as symmetric as the above.

If you know all your values to be positive, you can drop a number of absolute value computations in the above, and several definitions will become the same.

Upvotes: 3

Related Questions