Transformations

advertisement
Logarithmic Transformations
Learning Objectives
After completion of this module, the student will be able to
1. perform and interpret logarithmic transformations for graphical
display
2. make predictions based on a trendline
Knowledge and Skills
1. plotting data using the Excel Scatter Plot tool
2. logarithmic transformations within Excel
3. fitting a trendline to data using the Excel Trendline function
Prerequisites
1. natural logarithms and exponential functions
2. equation of a straight line
Citation: Neuhauser, C. Logarithmic Transformations.
Created: August 12, 2009 Revisions:
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 1
Two Examples
Example 1: Campbell (1996), page 1109, shows a graph that illustrates the decrease in fecundity at high
population densities in a small herb, plantain (Plantago major). The data can be found in the
spreadsheet under the Plantain tab. On the horizontal axis is the number of seeds planted per m2, on
the vertical axis is the average number of seeds per reproducing individual (Figure 1). We make two
observations: (1) Both axes are on a logarithmic scale, that is, distances on the axes are proportional to
the logarithms of the values. (2) The points seem to follow a straight line.
Figure 1: Data points on a graph where both axes are logarithmically transformed. (Drawn after Campbell, 1996 1.)
On either axis, the numbers span several orders of magnitude. Graphing the points in this way makes it
easier to see the relationship since the data almost follow a straight line on this graph.
Example 2: Fournier et al. (1980) studied tumor growth in breast cancer. They obtained growth data
from breast cancer tumors in patients based on the diameters of tumors over time. The data plotted in
Figure 2 comes from a single patient and shows the increase in tumor cells over time based on a simple
tumor model. The data can be found in the spreadsheet under the Patient 1 tab. We make two
observations: (1) The vertical axis is on a logarithmic scale, that is, distances on the vertical axis are
1
Campbell, N.A. (1996) Biology. Fourth Edition. The Benjamin/Cummings Publishing Company, Inc.
Citation: Neuhauser, C. Logarithmic Transformations.
Created: August 12, 2009 Revisions:
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 2
proportional to the logarithms of the values; and the horizontal axis is on a linear scale, that is, distances
on the horizontal axis are proportional to the values. (2) The points seem to follow a straight line.
Figure 2: Data points on a graph where the vertical axis is logarithmically transformed.
The Logarithmic Scale
A scale where distances are proportional to the logarithms of the values as in the graphs above is called
a logarithmic scale. Below, we display the logarithmic scale in two ways. On the top axis, we display the
values of x, and on the bottom axis, we display the values of log x (here: log x means the logarithm to
base 10):
0.01
-2
0.1
-1
1
0
10
1
100
2
1000
3
x
log x
Citation: Neuhauser, C. Logarithmic Transformations.
Created: August 12, 2009 Revisions:
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 3
On the top axis we see that multiples of 10 are equidistant. On the bottom axis we see that the
logarithms of the quantity x are equidistant.
In-class Activity 1
(a) On the two axes above find the following numbers: x=0.05, 0.2, 8, 15, 750. (b) Why do you think we
choose logarithms to base 10, instead of some other base? (c) Can you plot negative numbers on a
logarithmic scale? (d) As x approaches 0, where would you find x on a logarithmic scale?
Exponential and Power Functions
The two most frequent transformations of a relationship y  f (x) are (1) both axes are logarithmically
transformed or (2) the y-axis is logarithmically transformed and the x-axis is on a linear scale. In either
case, when such a transformation results in a straight line, we can find the analytical form of the
relationship.
Case 1: Both axes are logarithmically transformed
If the relationship between log y and log x is linear, we can write
log y  B  a log x
where B is the intercept on the vertical axis and a is the slope.
log y  B  a log x
y  10[Balog x ]
y  10B 10a log x
a
10log x  x a
With b  10 , we can now write
B
y  bx a
Citation: Neuhauser, C. Logarithmic Transformations.
Created: August 12, 2009 Revisions:
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 4
This is a power function. We can summarize this result.
If both axes are logarithmically transformed and a straight line results, then the relationship
between x and y is a power function: y  bx a
Case 2: The x-axis is on an arithmetic scale and the y-axis is logarithmically transformed
If the relationship between log y and x is linear, we can write
log y  C  mx
where C is the intercept on the vertical axis and m is the slope.
log y  C  mx
y  10[C  mx ]
y  10C 10mx
(10m )x
With c  10
C
and a  10 , we can now write
m
y  ca x
This is an exponential function. We can summarize this result.
If the x-axis is on an arithmetic scale and the y-axis is logarithmically transformed and a
straight line results, then the relationship between x and y is an exponential function:
y  ca x
Citation: Neuhauser, C. Logarithmic Transformations.
Created: August 12, 2009 Revisions:
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 5
Graphing and Transforming Axes in Excel
Let’s graph y  x 2 for x  1,3,4 and 7. In Excel, prepare the following table:
1
2
3
4
5
6
A
B
x
2
x
1
3
4
7
C
1
9
16
49
Instructions for Table



Enter the numbers 1,3,4, and 7 into the Cells A2 to A5 as shown in the table.
To obtain the function values, type into Cell B2 “=A2^2” (without the quotation marks).
Click on Cell A2, move the cursor to the lower right corner until it changes to a solid black cross, leftclick the mouse, and drag the cell down to Cell B5. Excel will automatically fill in the appropriate
values as shown in the table.
Instructions for Graph








To graph the data points, we highlight the array A2:B5 and click on the Insert tab on top of the
ribbon. This will open the Insert ribbon.
Click on Scatter category in the Charts group. This will open a drop down list of chart types in this
category.
If you move your mouse pointer over a chart type, a description will appear. Select the Scatter with
only Markers chart. A chart will be inserted into your spreadsheet.
When you click on the graph, the Chart Tools option will appear on top of the ribbon. Click on the
Layout tab. The Layout ribbon will appear. It has options for adding Labels to the graph and making
changes to the Axes.
Let’s add Axes Titles. Click on Axes Titles. There are two options: Primary Horizontal Axis Title and
Primary Vertical Axis Title. Each option expands into options for the placement of the title.
For the Primary Horizontal Axis, select the Title Below Axis option. Type “x” (without the quotation
marks) and press the Enter key on your keyboard.
For the Primary Vertical Axis Title, select the Rotated Title option and type “y” (without the
quotation marks). Press the Enter key on your key board.
To add a title to the graph, click on Chart Title and select the Above Chart option. Type “Power
Function” (without the quotation marks). Press the Enter key on your key board.
Citation: Neuhauser, C. Logarithmic Transformations.
Created: August 12, 2009 Revisions:
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 6


Click on the label “Series 1” and delete it.
To change axes, select the Axes option in the Axes group. Select the Primary Horizontal Axis option
and select the More Primary Horizontal Axis Options. This opens a window where you can change
axis options manually. It allows you to manually set the minimum and the maximum value displayed
on the axis, the major unit, whether the values should be displayed in Reverse order, and whether
you want the axis to be on a Logarithmic scale. Check the box for Logarithmic scale and close the
window. Repeat the same for the vertical axis.
Instructions for Trendline






To add a trendline to the data points, click on Trendline in the Analysis group. Select More
Trendline Options. This opens a window.
To plot the appropriate trendline, select Power.
If you want to see the equation of the graph, check the Display Equation on chart box.
If you want to know how good the fit is, check the Display R-squared value on chart box.
Click on Close.
You should have a graph that looks as follows:
Citation: Neuhauser, C. Logarithmic Transformations.
Created: August 12, 2009 Revisions:
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 7
In-class Activity 2
Graph each of the following functions for the indicated values of x in Excel and transform the axes so
that a straight line results. Use the Trendline option to fit a straight line. Display the equation on the
chart.
(a) y  2x 3 for x  1,2,3,5,6,7,9 and 10
(b) y  2.5  3 x for x  1,2,3,5,6,7,9 and 10
In-class Activity 3
Fit functions to both the Plantain and Patient 1 data in the spreadsheet.
Citation: Neuhauser, C. Logarithmic Transformations.
Created: August 12, 2009 Revisions:
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 8
Download