Statistics Notes: LogarithmsBMJ 1996; 312 doi: https://doi.org/10.1136/bmj.312.7032.700 (Published 16 March 1996) Cite this as: BMJ 1996;312:700
- a Department of Public Health Sciences, St George's Hospital Medical School, London SW17 0RE
- b ICRF Medical Statistics Group, Centre for Statistics in Medicine, Institute of Health Sciences, PO Box 777, Oxford OX3 7LF
- Correspondence to: Professor Bland.
Logarithms (or logs for short) are much used in statistics. We often analyse the logs of measurements rather than the measurements themselves, and some widely used methods of analysis, such as logistic and Cox regression, produce coefficients on a logarithmic scale. Here we shall give a brief summary of the properties of logarithms which make them so useful.
We shall start with logarithms to base 10. These are the common logarithms formerly widely used to do calculations for which we now use calculators and computers. The log to base 10 of a number a is b where a=10b. We write b=log10a. Thus for example log10(10)=1, log10(100)=2, log10(1000)=3, log10(10000)=4, and so on. It is common to omit the brackets and write log10a, but we are using them for clarity.
If we multiply two numbers, the log of the product is the sum of their logs: log(ab)=log(a)+log(b). For example, 100x1000=102x103=102+3=105=100000. Or in log terms: log10(100x1000)=log10(100)+log10(1000)=2+3=5. Hence 100x1000=105=100000. It follows that any multiplicative relationship of the form y=axbxcxd can be made additive by a log transformation: log(y)=log(a)+log(b)+log(c)+log(d). Likewise, the difference between two logs is the log of the ratio: log(a)-log(b)=log (a/b). As statistical methods cope with additive relationships much more easily than with multiplicative ones, logarithms have many uses. As we shall see in future Statistics Notes, working with the logarithms of data rather than the data themselves may have several advantages. Multiplicative relationships may become additive, skewed distributions may become symmetrical, and curves may become straight lines.
Most scientific calculators have a LOG key, which will give the logarithm of the number in the display. They usually have a 10x key, too, which gives us the number of which the display is the logarithm. This is called the antilogarithm or antilog and is useful when dealign with the results of calculations on the log scale.
Many statistical computer programs do not use logs to base 10, but logs to the base e, called natural logarithms. Here e=2.7183 … is a mathematical constant, in much the same way that (pi)=3.1412…. Mathematicians, and hence statisticians, almost always use logs to the base e because it simplifies many formulae. On a calculator this is usually given by the LN key, and the antilog by the ex key. The numerical relation between logs to base e and base 10 is that log10(e)xloge(x)=log10(x). Natural logarithms are also written as ln(x), or often simply as log(x).
The base which is used for logarithms is a matter of convenience, depending only on the particular application. The base chosen affects the values of the logs themselves, but nothing else. Provided we use the correct antilog to return to the natural scale, it does not matter what base we use.