Log-Transformations Printer Friendly
Log-Transformations Printer Friendly
Visualization:
Log Transformations
URL: http://mathbench.umd.edu/modules/visualization_log-
transformations/page01.htm
Note: All printer-friendly versions of the modules use an amazing new interactive technique
called “cover up the answers”. You know what to do…
In this module we're going to discuss ways of combining logs and graphics. You remember logs,
right? Just in case you don't, here are 2 pictures of logs again:
Remember that the log of the measurement basically tells you how much space that number takes
up.
If the measurement is bigger than one, it "takes up space" in front of the decimal and the log is
positive. A 6-digit number has a log of 5-point-something. A 10-digit number has a log of 9-
point-something.
If the measurement is smaller than one, it only "takes up space" AFTER the decimal point, and
the log is negative.
A measurement of zero doesn't take up any space before OR after the decimal point, and it has
no log. Neither does a negative measurement. That's okay, because usually we're using logs to
measure things size, weight, height, or the number of organisms in a population. These
measurements can't be negative in any case.
It's all very well to take logs of individual numbers, but what we really want is to be able to
visualize these numbers in relation to other numbers. Therefore we need to make graphs. There
are two ways you can do this.
1. Take the log of each number, and then make a normal graph.
2. Make a graph, and let the paper "take the log" of the number.
Assuming you have a calculator, it's pretty easy to take the log of each number and then make a
graph on normal graph paper. (It might take some time, but that's your problem, right?).
Here's an example. First, just show you the normal graph. No logs involved here. Nothing up my
sleeve, either.
time (hrs) 12 24 36 48 60
# bacteria 10 100 1,000 10,000 100,000
There is problem with this graph -- the y values (number of bacteria) are in the bottom 10% of the
graph, except for the very last value. Because the last value is 10 times bigger than any of the
other values, the other values all get squished.
But, you should notice something interesting about the data. Every hour, the number of bacteria
increases by a factor of 10. That is, the number of bacteria multiply. So, what we need is a
multiplicative scale. And that's what logs are. The log tells you how many places the number
takes up -- in other words, how many times the number has been multiplied by 10.
So, let's try the same graph, but take the logs of the data first. Once again, if you want to play
along at home, yet your calculator, find the logs, and make the graph. Or, just click on the button.
time (hrs) 12 24 36 48 60
# bacteria 10 100 1,000 10,000 100,000
log (# bacteria) 1 2 3 4 5
You probably noticed the curvy line on the original graph turned into a straight line on the log
transformed graph.
1. As you increase a log by 1, you're increasing the magnitude of the original measurement by a
factor of 10.
2. When you allow an additional unit of time to go by (in this case, half a day), you're allowing
the bacteria to increase by a factor of 10.
So, taking the log accounts for the multiplying nature of bacterial growth, and all you're left with
on the graph is a straight line, pointing upwards.
When growth happens by multiplying the population by a constant number each timestep, we call
that exponential growth. And any time you have exponential growth, taking the log of the
population size will turn the graph into a straight line. Even if the constant multiplier is not 10 --
in which case your straight line will have a different slope, but it will still be straight.
That doesn't mean that all curvy lines become straight lines if you log-transform the data. The
straightening effect only occurs if the original graph involves exponential growth -- that is,
growth with the constant multiplier. Or exponential "de-growth" (decay).
Nevertheless, many kinds of graphs to become "un-squished" when you log transform the data.
Transforming the data can be especially useful when there are big differences in the magnitudes
of the numbers you're working with. If most of your numbers are fairly small, but there are a few
very large numbers, he can really help to log-transform the data.
Remember, logs are all about orders of magnitude. So, if your data differs by a couple orders of
magnitude or more, then you might want to think about log-transforming it.
In the first method, you transform first, then graph. In the second method, you graph first -- then
let the graph paper do all the hard work. You just have to use a special graph paper with a log
scale.
www.mathbench.umd.edu Log transformations May 2010 page 4
In the example we've been using so far, we want to take the log of the data on the y-axis, but the
data on x-axis is fine the way it is. Therefore, we want to use semi-log paper.
This is called a "cycle, " and in this case it goes from 100 to 1000. The cycle is always divided
into 10 pieces, as shown on the left (100 - 200 - 300 - 400 ... ). I'm sure you've noticed that the
lines get closer together at the top of the cycle -- that's because the numbers are arranged on a log
scale. The number half-way between 100 and 1000 is NOT 550, as on an ordinary scale, but
rather (approximately) 300.
On the right, I'm showing you how the measurements on the left correspond to their logged
values on the right -- normally these purple numbers are NOT written on the graph. However, I'm
doing it so that you can see that the LOGGED numbers proceed in an orderly fashion, with 2.48
being just about in the middle between 2 and 3.
You can stack several cycles to get paper that spans several orders of magnitude (every time you
multiply by 10, you get 1 order of magnitude). Here are two possibilities.
www.mathbench.umd.edu Log transformations May 2010 page 5
How many cycles would you need to represent the following data:
year 1990 1991 1992 1993 1994 1995 1996 1997 1998
popn. size 3 17 190 2871 6743 34 590 4282 38,475
How many cycles would you need to represent the following data:
day 1990 1991 1992 1993 1994 1995 1996 1997 1998
cell size
0.003 0.017 0.290 0.2871 6.743 34.0 0.590 0.04282 3.8475
(um)
Try it out
The following table contains data on human population growth over the last 3000 years. Above,
this data is plotted on a normal graph. Because the data spans many orders of magnitude, the
graph looks kinda empty. This is a good candidate for log transformation -- can you correctly
place each point on the semi-log paper below?
1000 0
year 1000 1400 1750 1850 1950 1970 1980 1990 2007
BC AD
popn.
size
50 200 300 220 790 1260 2520 3690 4430 5260 6600
(millions
)
www.mathbench.umd.edu Log transformations May 2010 page 7
Here is one last dataset. This data represents the biomass of bacteria growing in a medium. At
first there are virtually unlimited resources, and the bacteria multiplies at a constant rate. Later,
when the bacteria reach the limit of the resources, there is a period of steady population size.
Finally the population declines as resources are exhausted.
Week 1 2 3 4 5 6 7 8 9
So, both the left side of the graph is a straight line heading up -- because the bacteria are growing
exponentially, i.e., multiplying by a constant fact. And the right side of the graph is a straight line
heading down -- because the bacteria are dying off exponentially, i.e., each timestep there is a
constant fraction of the number there were the timestep before. These straight lines are diagnostic
of exponential growth and exponential decay.
Review
If your data differs by a couple orders of magnitude or more, then an ordinary graph will make
your data look "squished", and you might want to think about a log-transformation. There are two
ways you can do this.
1. Take the log of each number, and then make a normal graph.
2. Make a graph, and let the paper "take the log" of the number.
As an added bonus, IF your data represents an exponential growth or decay process, THEN log-
transforming it will turn the graph into a straight line. (The slope of the line will even give you a
hint as to the rate of the exponential growth or decay, although we didn't get into this.)
Semi-log paper is tricky to use at first. It is divided into "cycles," which are themselves divided
into 10 pieces. The lines get closer together at the top of the cycle, because the numbers are
arranged on a log scale. Each cycle starts at a multiple of ten, and its NOT possible to get to zero.