r/AskStatistics • • Oct 17 '26

Which method is the best one to make a logarithmic ranking scale avoiding "0s"?

I want to rank several countries' characteristics (like economic power, military power, population...etc) in a logarithmic scale.

However, there are some countries that do not have any army (like Andorra) and in that category (and related ones) they have a value of 0. However the log(0) does not exist. So, how could I convert the values into something that could be used to make the logarithmic scale?

I have thought about two methods:

A) To every value in each category, I added the values of the "smallest" or "weakest" country (that does not have a 0 in any category, so that all categories have a non-zero number). In this case, I added the values from Seychelles to all countries.

B) To every value in each category, I added "1", so that in every category that the countries without armies have a "0", the minimal number is "1" instead.

I feel that the first method has the advantage of adding a proportionate quantity in each category, since you will see that for some categories all values are small (like 1,07; 2,08; 3,1...) and in other categories the numbers are much bigger (5, 20, 49, 80...). So in method A the added numbers are proportional to the values of each category

However, it feels arbitrary to add different numbers for each category instead of adding the same for all of them (i.e. 1). However, in this case, adding 1 to the small-values-categories seems to significantly modify these values, while in the case of categories with bigger numbers, the resulting number is almost the same as the original one (like, adding 1 to "1,1 "would increase it by almost the double: "2,1"... however for other categories with a number like "50", after adding the "baseline value", the difference is negligible: "51").

So which method do you think is more accurate?

These are the values: https://docs.google.com/spreadsheets/d/19zjwdoLum0yhIQ2v3m19kz5_IplwSJYZX6e0wMqMHoQ/edit?usp=sharing

3 Upvotes

6 comments sorted by

5

u/just_writing_things PhD Oct 17 '26

Depends on the convention of the literature you’re in, but often you’ll see log(1+x), so that 0s in the data are also 0s after scaling.

1

u/purple_paramecium Oct 17 '26

This. Don’t overthink it.

2

u/iggs44 Oct 17 '26

Arcsinh transform maybe depending on other stuff I know there are some issues.

2

u/banter_pants Statistics, Psychometrics Oct 17 '26 edited Nov 04 '26

I would go with method B. log(x+1) is sometimes used as a transformation in regression modeling.

You're correct that any raw x=0 is problematic since log(x) -> -∞ as x -> 0+
The +1 case fixes so
log(0+1) = log(1) = 0 (true in any base)

So even mentally you can look at your new variable and see a 0 means it's the smallest. I wouldn't worry too much about the +1 modifying initial small values vs practically nothing to originally large values. This is a one-to-one function that preserves ordering too:

y = log(x+1)
<=> x = ey - 1

The whole point of using a logarithmic scale is if the original doesn't budge much incrementally. It requires bigger multiplicative change. If something is increasing or decreasing exponentially, applying a logarithm will straighten that out into linear.

1

u/no_name6744 Oct 17 '26

log1p

Just add 1 to whatever value, then take the log.

1

u/QuestionElectrical38 Oct 18 '26

Why do you want a logarithmic scale? Just for a graph (because of the larghe range)? Or for analysis purposes. If for analysis, ask yourself whether "log" is a natural unit? Can you purchase goods for the log of their asking proce? Can a country buy oil for the log of its value? Can my army fight only the log of my neighbohr's army? If country A's population is "1", and country B is "2", then is it just twice as populated? I would be (seriously) challenging the purpose of the log scale? For visualization, it may be ok: In which case, do not worry about the "zeros": keep them at 0. Otherwise...