Tutorials › Exam PA - Predictive Analytics › Raw and Logarithmic Axes for Skewed Data

Exam PA · Visualization and Anomaly Detection · Tutorial 143 of 966

Raw and Logarithmic Axes for Skewed Data

Learn to read raw and logarithmic axes for the same positive data, calculate displayed positions, and distinguish a change in scale from a change in the observations.

Beginner 10 min read

What You'll Learn

  • Explain why equal ratios, rather than equal differences, receive equal spacing on a logarithmic axis
  • Compare the displayed positions of the same observations on raw and log scales
  • Calculate a value's relative position between two endpoints on each scale
  • Distinguish a log-scaled axis from replacing the recorded observations with their logarithms
  • Identify why zero and negative values cannot be displayed on a standard logarithmic axis

Why Compare Raw and Logarithmic Axes?

A raw axis gives equal visual distances to equal differences. On a logarithmic axis, equal visual distances instead represent equal ratios. This difference matters when positive observations span several orders of magnitude: a few large values can occupy much of a raw scale, while a log scale can make multiplicative patterns easier to see.

The key comparison is between two displays of the same recorded observations. Changing an axis changes how positions are mapped to the page; it does not change the underlying records. This is a display choice, not evidence that the data themselves have changed or that a particular statistical model is appropriate.

Definition: On a raw (linear) axis, a value \(x\) is mapped linearly to position. On a logarithmic axis with base \(b>1\), a positive value \(x\) is positioned according to \(\log_b(x)\). Equal differences in the displayed log coordinate therefore correspond to equal multiplicative ratios in the original values.

What the Two Scales Show

Suppose the horizontal axis runs from \(a\) to \(c\), where \(0<a<c\), and we want the relative position of an observation \(x\) between them. On a raw axis, the fraction of the axis length from \(a\) to \(x\) is \((x-a)/(c-a)\). On a log axis, the fraction is based on differences between logarithms. The logarithmic fraction can also be written using ratios:

$$ p_{\text{raw}}=\frac{x-a}{c-a}, \qquad p_{\log}=\frac{\log_b(x)-\log_b(a)}{\log_b(c)-\log_b(a)} =\frac{\log_b(x/a)}{\log_b(c/a)}. $$

Both fractions range from 0 at \(a\) to 1 at \(c\). But they generally differ for values between the endpoints. On a raw scale, an observation halfway across the axis is the arithmetic midpoint. On a log scale, it is the geometric midpoint: its ratio to the lower endpoint equals the ratio of the upper endpoint to it.

Why Equal Ratios Have Equal Spacing

The spacing result follows directly from the logarithm rule for a quotient. For two positive observations \(x_1<x_2\), their separation in log coordinates is \(\log_b(x_2)-\log_b(x_1)\). The difference of these logarithms is the logarithm of their ratio. Consequently, multiplying both observations by the same positive factor preserves their log-coordinate separation.

$$ \log_b(x_2)-\log_b(x_1) =\log_b\left(\frac{x_2}{x_1}\right). $$

For example, a move from 10 to 20 has the same log-coordinate distance as a move from 100 to 200, because both moves multiply the starting value by 2. Their raw differences are 10 and 100, so they do not have the same distance on a raw axis. The logarithm base affects the numeric units of the log coordinate, but not this comparison: changing from base 10 to base \(e\) multiplies all log coordinates by a constant and preserves their relative spacing.

Worked Example: Locating Doubling Values on Both Scales

A hypothetical portfolio summary has positive recorded amounts of 10, 20, 40, 80, and 160 units. Compare the positions of 20, 40, and 80 between endpoints 10 and 160 on raw and base-10 logarithmic axes. Give positions as fractions of the full axis length, rounded to four decimal places at the final step.

Method. Calculate each raw fraction from the endpoint differences and each log fraction from the endpoint ratios. The endpoints span a raw difference of \(160-10=150\), and a log ratio of \(160/10=16\).

For 20, the raw fraction is \((20-10)/150=10/150=0.0667\). Its log fraction is \(\log_{10}(20/10)/\log_{10}(160/10)=\log_{10}(2)/\log_{10}(16)=1/4=0.2500\), since \(16=2^4\).

For 40, the raw fraction is \((40-10)/150=30/150=0.2000\). Its log fraction is \(\log_{10}(4)/\log_{10}(16)=2/4=0.5000\), since \(4=2^2\) and \(16=2^4\).

For 80, the raw fraction is \((80-10)/150=70/150=0.4667\). Its log fraction is \(\log_{10}(8)/\log_{10}(16)=3/4=0.7500\), since \(8=2^3\).

Check. The log positions of 20, 40, and 80 are one-quarter, one-half, and three-quarters of the axis: each doubling adds the same log distance. The raw positions are not equally spaced because the raw gaps are 10, 20, and 40. The common mistake is to assume that equal raw gaps and equal ratios mean the same thing; they do not.

Worked Comparison With Uneven Ratios

Not every value lies at a simple fraction of a logarithmic scale. The formula still applies, but use unrounded logarithms for the calculation and round only the final result. This avoids small errors caused by rounding intermediate values too early.

Worked Example: Comparing a Dollar Amount's Position

A hypothetical set of positive claim amounts is displayed from $100 to $1,100. Find the position of $300 as a fraction of the full axis length on raw and base-10 logarithmic axes. Round final positions to four decimal places.

Raw-axis calculation. The full range is \(1{,}100-100=1{,}000\). The amount $300 is \(300-100=200\) above the lower endpoint, so its raw position is \(200/1{,}000=0.2000\).

Log-axis calculation. The log position is calculated from the ratios to the lower endpoint:

$$ p_{\log} =\frac{\log_{10}(300/100)}{\log_{10}(1{,}100/100)} =\frac{\log_{10}(3)}{\log_{10}(11)} =\frac{0.4771212547\ldots}{1.0413926852\ldots} \approx 0.4582. $$

Check. The log position, about 0.4582, is greater than the raw position, 0.2000. That is expected: $300 is three times the lower endpoint, while the upper endpoint is eleven times the lower endpoint. The log-axis calculation uses the full-precision logarithms before rounding the final fraction. The common mistake is to treat a log-axis position as the raw proportion of dollars above the minimum.

Displaying the Same Records in R

For a simple display of positive measurements against their observation numbers, a raw-axis plot uses the recorded measurements on the axis. In base R, an expression such as plot(index, amount) gives the usual linear scale. Using plot(index, amount, log = "y") requests a logarithmic scale on the vertical axis. The plotted amounts remain the original values, and the axis tick labels are expressed in those original units.

An alternative is to calculate a new variable, such as \(\log_{10}(\text{amount})\), and plot that new variable on an ordinary linear axis. The positions are mathematically related to those of a base-10 log axis, but the axis labels and interpretation differ: the plotted coordinate is now the logarithm, not the original amount. State clearly which display you are using. A viewer should not have to guess whether an axis is in dollars or log-dollars.

An axis transformation does not add, delete, or correct observations. If a point appears less isolated on a log axis, it has not become less extreme in the original units; the visual mapping has changed. Likewise, apparent spacing should be interpreted in the scale shown. Two equal distances on a log axis indicate equal ratios, not equal dollar differences.

Worked Example: Reading a Log Axis for Multiplicative Growth

A hypothetical service records positive daily usage amounts of 5, 50, 500, and 5,000 units. The display spans from 5 to 5,000. Find the log-axis positions of 50 and 500 and compare them with their raw-axis positions. Round final fractions to four decimal places.

Method. The endpoint ratio is \(5{,}000/5=1{,}000=10^3\). Thus the full log-axis length is 3 base-10 log units.

For 50, the ratio to the lower endpoint is \(50/5=10\), so the log position is \(\log_{10}(10)/\log_{10}(1{,}000)=1/3=0.3333\). Its raw position is \((50-5)/(5{,}000-5)=45/4{,}995\approx0.0090\).

For 500, the ratio to the lower endpoint is \(500/5=100\), so the log position is \(\log_{10}(100)/\log_{10}(1{,}000)=2/3=0.6667\). Its raw position is \((500-5)/4{,}995=495/4{,}995\approx0.0991\).

Check. The log positions divide the axis into three equal intervals, because every adjacent value is ten times the previous one. The raw positions do not: the raw gaps are 45, 450, and 4,500 units. The common mistake is to read equal visual intervals on a log axis as equal increases in usage.

When a Logarithmic Axis Is Unsuitable

A standard logarithmic axis requires strictly positive values. Zero has no finite logarithm, and the logarithm of a negative real value is not defined. If the observations include zero or negative values, they cannot be placed directly on a standard log axis. Do not silently discard those records or replace them with an arbitrary small positive number: either action changes what the display communicates and requires a substantive justification.

A log scale is most useful when ratios are meaningful and the positive values cover a wide range. It is not automatically the best choice merely because a distribution looks skewed. A raw display preserves visual emphasis on absolute differences, which may be the more relevant comparison. A log display emphasizes relative differences. Neither scale makes the data more accurate, removes an unusual observation, or proves a particular distributional assumption.

The same observations can look compressed at one end of one scale and more evenly spread on another. For an exploratory analysis, make the scale explicit, state the measurement units, and explain whether the visual question concerns absolute changes or multiplicative changes. This is aligned with the SOA Exam PA (Predictive Analytics) syllabus: interpret what a visualization shows without claiming that a rescaling changed the records or established a cause.

Key takeaway: A raw axis spaces values by differences; a logarithmic axis spaces positive values by ratios. Always identify the scale, interpret the spacing in that scale, and keep the original observations distinct from any transformed display coordinates.

Check Your Understanding

For each problem, calculate or interpret the scale before deciding what the visual spacing means.

  1. A raw axis runs from 4 to 128. What fraction of its length lies between 4 and 8? What fraction lies between 4 and 8 on a base-2 logarithmic axis? (Answer: raw \(=4/124\approx0.0323\); log \(=\log_2(2)/\log_2(32)=0.2000\).)
  2. A base-10 log axis runs from 100 to 1,600. Compare the log and raw positions of 400. Round to four decimal places. (Answer: log \(=\log_{10}(4)/\log_{10}(16)=0.5000\); raw \(=300/1{,}500=0.2000\).)
  3. Three positive values are 20, 200, and 2,000. On a base-10 log axis spanning these endpoints, are the values equally spaced? Give the position of the middle value as a fraction of the full axis. (Answer: Yes; the middle value is at \(0.5000\), since the successive ratios are both 10.)
  4. A report includes measurements of 0, 12, and 120 units. Can all three be shown directly on a standard logarithmic axis? Explain the limitation. (Answer: No; zero has no finite logarithm, although 12 and 120 are positive and can be displayed.)
  5. A raw axis runs from 10 to 1,000. Find the positions of 100 on the raw and base-10 logarithmic scales, rounded to four decimal places. Explain which scale places it farther across the axis. (Answer: raw \(=90/990\approx0.0909\); log \(=\log_{10}(10)/\log_{10}(100)=0.5000\); the log scale places it farther across.)
Clinical Biostats