Scientists and others who work with data are generally familiar with the concept of re-plotting data on logarithmic scales, or plotting the log of x vs. the log of y, as a way of transforming the regression from a curve to a straight line. I recently realized that I had become hazy on the mathematical basis for this operation, and had forgotten some of the key properties of logarithms and exponents that allow you to move back and forth between the raw data and the log transform and relate the slope of the line on the log-log plot to the properties of the original curved function. I eventually learned what I needed but I had trouble finding a clear and succinct explanation on the Internet so I offer this one for anyone in a similar situation (and for myself next time I need a reminder).

First off, you might want to be sure you are clear on the difference between exponential and power functions, which is explained here.

Here is the short answer:

This is a fundamental property of logs that is best memorized.

NB: I am using the convention that "log" with no subscript means log_{10} while "ln" means natural log (log_{e})

Now lets look at an example to see exactly how that plays out. The plot below is for a simple power function:

where c = 2.5 and x is the set of whole numbers from 1 to 30.

Obviously it is curved and would be a logical candidate for a log-log transformation. So here is what happens if we take the log of both sides (using equation {1}):

In other words if we make the independent variable the log of x and the dependent variable the log of y, which happens to be 2.5*log(x), the dependent variable will be a simple multiple of the independent variable, which is the definition of a straight line. Our exponent, c (2.5), becomes the slope of a line on a log-log plot. Here is what it looks like:

You can check pretty easily that the slope of this line is 2.5; for example note that line goes through (0,0) and (1,2.5). And you can see from the mathematical relationship in {1} that any power function would behave the same way; that is, it does not matter whether the power is 2, -2, 3 or 100. That exponent will always become the slope of the line.

You might wonder about a more complex power function, such as:

And you might be wondering whether the straight line we get on the log-log plot always has an intercept of zero. Well these two questions are closely related. If our power function has a coefficient a, what happens when we take the logarithm? We get the term:

To deal with this requires our second property of logarithms that you may or may not remember from High School:

Using {2} on our power function gives us:

You can probably see that when we treat this as the equation for a straight line, log(a) becomes the vertical intercept while c is still the slope. Here is an example where a = 10 and c = 1.5:

And here is what it looks like when transformed to log-log. Note that the y-intercept is 1, which is the base 10 log of 10. The slope is of course 1.5.

This is actually the problem that got me started reviewing all this stuff. I was looking at a log-log plot in a book on power laws and fractals that simply told me the value of the slope of the line on the log-log plot and I was unsure how to back out the original, untransformed, equation. Just as if you were just given the preceding plot and told that the slope was 1.5. Now from the foregoing discussion you would already know that this meant the original equation was of the form x^{1.5} but how would you actually show that algebraically? Here is how:

where b is the intercept on the vertical axis and c is the slope of a line on a logx vs logy plot.

now we have:

The one property of logarithms that even I usually remember is:

so:

and one of the most basic laws of exponents is:

so:

now we can use {3} again to simplify the first coefficient:

this gives us:

and we can use {4} again to reduce the part in parentheses to x:

Home | Contact | Search | MTB | Family | Mini Cooper | Science Notes |