Tutorials › Introduction to Statistics › Why Nonlinear Transformations Change Group Gaps

Comparing Groups and Handling Outliers · Tutorial 197 of 996

Why Nonlinear Transformations Change Group Gaps

Learn why a transformation can preserve ranks while changing the numerical size—and sometimes the direction—of a comparison between group means.

Beginner 9 min read

What You'll Learn

  • Explain how increasing transformations preserve the ordering of observations.
  • Calculate and compare gaps before and after logarithm and square-root transformations.
  • Distinguish a transformed group mean from a transformation of the original-scale mean.
  • Interpret a difference between mean log values as a log ratio of geometric means.
  • Recognize how groups with different distributions can have their mean ordering change after transformation.

Why the Scale Changes the Comparison

A transformation can make a data set easier to describe, but it also changes the scale on which distances and group centers are measured. For example, taking logarithms preserves which of two positive observations is larger, yet it can make a large absolute difference at a high value look small compared with the same difference at a low value. Square roots also preserve order while compressing distances, especially among larger values.

This matters when comparing groups. A statement such as “Group B has a larger mean” depends on which values are averaged: the original observations, their logarithms, or their square roots. These are different summaries on different scales. A careful comparison identifies the scale and does not treat a transformed-scale difference as though it were an original-scale difference.

Definition: A transformation applies a function \(g\) to each observation \(x\), replacing it with \(g(x)\). The transformed data are the values \(g(x)\). A transformation is strictly increasing on its domain if \(a<b\) implies \(g(a)<g(b)\). Such a transformation preserves the ordering and ranks of individual observations, but it need not preserve distances between them or differences between group summaries.

Order Is Preserved, but Distance Is Not

The natural logarithm \(g(x)=\ln(x)\) is defined for \(x>0\) and is strictly increasing: if \(0<a<b\), then \(\ln(a)<\ln(b)\). The square-root transformation \(g(x)=\sqrt{x}\) is defined for \(x\geq 0\) and is also strictly increasing. Consequently, neither transformation reverses the order of any two individual observations within its domain. Ties remain ties as well.

The numerical distance between observations is another matter. For logarithms, the transformed difference between two positive values depends on their ratio. For square roots, the transformed difference depends on their original difference and their locations on the scale. These facts follow from two identities:

$$ \ln(b)-\ln(a)=\ln\left(\frac{b}{a}\right), \qquad \sqrt{b}-\sqrt{a}=\frac{b-a}{\sqrt{b}+\sqrt{a}} $$

The log identity means that a fixed ratio produces the same log difference, even when the values themselves are much larger. For instance, multiplying a positive value by 4 adds \(\ln(4)\) to its logarithm. The square-root identity shows that for the same original gap \(b-a\), the transformed gap is smaller when the denominator \(\sqrt{b}+\sqrt{a}\) is larger. Thus both transformations tend to compress distances at higher values, but they do so according to different rules.

Worked Example: Equal Gaps at Different Locations

Compare the pairs \(1,4\) and \(16,19\). Each pair has an original-scale gap of 3. Calculate the gaps after taking square roots and natural logarithms. Treat the observations as positive numerical values in one fixed unit.

Square roots. For the first pair, the transformed gap is \(\sqrt{4}-\sqrt{1}=2-1=1\). For the second pair, it is:

$$ \sqrt{19}-\sqrt{16} =\frac{19-16}{\sqrt{19}+\sqrt{16}} =\frac{3}{\sqrt{19}+4} \approx \frac{3}{8.359} \approx 0.359 $$

Both original gaps are 3, but the transformed gap is much smaller for the pair at the higher values.

Natural logarithms. The transformed gaps are \(\ln(4)-\ln(1)=\ln(4)\approx 1.386\) and \(\ln(19)-\ln(16)=\ln(19/16)\approx 0.172\). Again, the same original absolute gap produces different transformed gaps. The first pair has ratio \(4/1=4\), while the second has ratio \(19/16\), which is much closer to 1.

The observations retain their order in both calculations: \(1\) remains below \(4\), and \(16\) remains below \(19\). What changes is the size of the gap used to describe each pair.

Group Centers Depend on the Scale

A group mean is calculated from the values on the chosen scale. If the original observations are \(x_1,\ldots,x_n\), their original-scale mean is \(\bar{x}=(x_1+\cdots+x_n)/n\). The mean after transformation is \((g(x_1)+\cdots+g(x_n))/n\). In general, this transformed mean is not \(g(\bar{x})\). Transforming each observation and then averaging is a different operation from averaging the observations and then transforming the result.

For positive data, the mean of the natural logarithms has a useful interpretation. If \(y_i=\ln(x_i/c)\), where \(c\) is a fixed positive reference with the same units as \(x_i\), then:

$$ \bar{y} =\frac{1}{n}\sum_{i=1}^{n}\ln(x_i/c) =\ln\left(\frac{1}{n}\sum_{i=1}^{n}\ln(x_i/c)\text{ exponentiated}\right) =\ln\left(\frac{(x_1x_2\cdots x_n)^{1/n}}{c}\right) $$

In the middle expression, exponentiating the average log gives the geometric mean of the observations relative to \(c\). More directly, \(\exp(\bar{y})=(x_1x_2\cdots x_n)^{1/n}/c\). Therefore, a difference between group means on the log scale describes a ratio of geometric means, not a difference between arithmetic means on the original scale. The reference \(c\) makes the logarithm’s input dimensionless; using the same reference for both groups leaves their difference unchanged.

Worked Example: Comparing Means on the Original and Log Scales

Suppose two hypothetical groups have positive measurements, recorded in milligrams: Group A has \(1,4,16\) mg, and Group B has \(4,16,64\) mg. Compare their arithmetic means with their means after transforming each value to \(y=\ln(x/(1\text{ mg}))\).

Original-scale means. For Group A, \(\bar{x}_A=(1+4+16)/3=21/3=7\) mg. For Group B, \(\bar{x}_B=(4+16+64)/3=84/3=28\) mg. The original-scale difference is \(28-7=21\) mg.

Log-scale means. The transformed values for Group A are \(0\), \(\ln(4)\approx1.386\), and \(\ln(16)\approx2.773\). Thus:

$$ \bar{y}_A =\frac{0+1.386+2.773}{3} \approx 1.386 $$

For Group B, the transformed values are \(\ln(4)\approx1.386\), \(\ln(16)\approx2.773\), and \(\ln(64)\approx4.159\). Thus:

$$ \bar{y}_B =\frac{1.386+2.773+4.159}{3} \approx 2.773 $$

The log-scale difference is \(2.773-1.386=1.386\), approximately \(\ln(4)\). In fact, each value in Group B is four times its corresponding value in Group A, so the geometric mean for B is four times the geometric mean for A. The log-scale difference describes that ratio. It is not a difference of \(1.386\) mg, and it is not the original-scale arithmetic mean difference of \(21\) mg.

A Transformation Can Change Which Group Mean Is Larger

Order preservation applies to individual observations, not necessarily to group means. Each value within a group stays in its original rank order under a strictly increasing transformation. But a group mean combines all values in that group, and a nonlinear transformation changes the contribution of each value to that average. If groups have different distributions, their mean ordering can therefore change.

Worked Example: A Change in the Ordering of Group Means

Consider two hypothetical groups of nonnegative counts. Group A contains \(0\) and \(100\); Group B contains \(40\) and \(40\). Compare the arithmetic means before and after applying the square-root transformation.

Original scale. Group A has mean \((0+100)/2=50\) counts. Group B has mean \((40+40)/2=40\) counts. On the original scale, Group A’s mean is 10 counts higher.

Square-root scale. Group A’s transformed observations are \(0\) and \(10\), giving a transformed mean of \((0+10)/2=5\). Group B’s transformed observations are both \(\sqrt{40}\approx6.325\), giving a transformed mean of \((6.325+6.325)/2=6.325\). On the square-root scale, Group B’s mean is about \(1.325\) transformed units higher.

There is no reversal of individual ranks: \(0<40<100\) still corresponds to \(0<\sqrt{40}<10\). The group means change order because the two groups have different patterns of values. Group A combines a very small value with a very large one, while Group B has two equal middle values. The transformation reduces the influence of Group A’s large observation on its mean.

Why Nonlinear Transformations Change Centers

The examples show a general point: a group center is a summary of values on a particular scale. For a linear transformation such as multiplying every observation by a positive constant, distances and means change in a consistent, proportional way. A nonlinear transformation does not have one fixed multiplier for every gap. The size of the change depends on where the observations lie and how they are distributed.

The difference between a transformed mean and a transformed original mean can also be seen directly. For the values \(1,4,16\), the arithmetic mean is \(7\), so \(\ln(7)\approx1.946\). The mean of the logarithms is instead \((\ln(1)+\ln(4)+\ln(16))/3\approx1.386\). These are unequal. Exponentiating the latter gives \(4\), the geometric mean of \(1,4,16\), whereas exponentiating \(\ln(7)\) gives the arithmetic mean, \(7\).

This distinction is useful whenever a transformed scale is used to describe group differences. A transformed-scale center can make relative differences or patterns easier to see, but its meaning is tied to that scale. To communicate results clearly, identify whether the reported center or gap is on the original scale or transformed scale, and give its units or interpretation accordingly.

Common Mistakes

  • Assuming preserved order means preserved gaps. The fact that \(a<b\) still implies \(g(a)<g(b)\) does not mean \(g(b)-g(a)=b-a\). Check the transformed difference itself.
  • Calling a log-scale difference an original-scale difference. For natural logarithms, a difference of log means corresponds to a log ratio of geometric means. It is not a difference in the original measurement units.
  • Transforming only the reported mean. The mean of transformed observations is generally not the transformation of the original mean. State which calculation was performed.
  • Assuming group mean order must be preserved. Individual ranks are preserved, but averages can change order when groups have different distributions, as in the square-root example.
  • Taking logarithms of zero or negative values. The natural logarithm requires positive inputs. Square roots require nonnegative inputs. Check the domain before applying either transformation.
Key takeaway: Logarithms and square roots preserve individual ordering over their domains, but they change distances and group centers. A comparison on a transformed scale must be interpreted on that scale; it cannot automatically be read as the same difference between original-scale group means.

Check Your Understanding

Try these questions without looking back.

  1. Two positive observations have the same ratio, \(b/a\), as another pair. What can you say about the differences between their natural logarithms?
  2. For the values \(9\) and \(25\), calculate the original gap and the square-root-transformed gap. Why are the two gaps different?
  3. A group has positive observations \(1,9,25\). Explain why the mean of their natural logarithms is not generally the logarithm of their arithmetic mean.
  4. Can a strictly increasing transformation reverse the order of two individual observations? Can it change the order of two groups’ means? Explain the distinction.
  5. Why must the natural logarithm not be applied directly to a zero observation?