# Absolute deviation from the mean using logarithms

I am calculating the absolute deviation from the mean of a strictly positive set $$\{x_1, x_2, \ldots, x_n\}$$ like:

$$\left| x_i - \bar X\right|$$

My analysis makes it appropriate to work in logs because I care about (relative) percentage changes, like:

$$\left| \ln(x_i) - \ln(\bar X)\right |.$$

The idea is to understand how spread out the data is with regards to the central tendency of the sample, here measured as the log of the arithmetic mean of the raw data, $$\ln(\bar X)$$.

I see both log mean, $$\ln(\bar X)$$, and mean log, $$\overline{\ln(X)}$$, measures adopted in many scientific papers. Now my question: which is more appropriate, the distance to the logarithm of the mean or the distance to the mean of the log transformed data?

A very related question is here: log mean vs mean log in statistics, but it does not really adress the question in relation to central tendency.

• There is only one mathematical obstacle to doing this: if any of your data are non-positive, the log is not uniquely defined.
– whuber
Dec 6, 2022 at 16:02
• My data is indeed strictly positive. Lets say rather is there a statistical advantage over using the distance from the log mean vs. the distance from the mean log? Dec 6, 2022 at 19:14
• It depends. The differences between logs represent a different property and will have different statistical characteristics than differences between the raw data. We can't give you an answer without knowing something about the data and why you might want to do this -- but there are no mathematical reasons either to do it or not to do it.
– whuber
Dec 6, 2022 at 21:28
• The reason for the log transformation is mainly the interpretation of the data (see update above). Dec 7, 2022 at 9:21

If your $$X$$ data are log-normally distributed and you want to use a measure like $$\left| \ln(x_i) - C\right |$$ to describe the spread of the data, where $$C$$ is some measure of central tendency, then the better choice is to use the mean of the logs, $$\overline{\ln(X)}$$, rather than the log of the mean, $$\ln(\bar X)$$, for $$C$$. Otherwise you end up with a bias in your measure of spread. A quick example in R:

set.seed(202)
logNdata <- rlnorm(1000) ## standard random lognormal
(logMean <- log(mean(logNdata)))
#  0.5240655
(meanLog <- mean(log(logNdata)))
#  0.01173122
mean(log(logNdata)-logMean)
#  -0.5123343
mean(log(logNdata)-meanLog)
#  1.458724e-17


That's consistent with what's said on the page to which you linked:

If a log transformation of the data is appropriate then you should typically do the transformation on the original data first, whatever you call that process.