I would like to use the cube root transform on data in order to preserve the sign of the original data and 0 values. The data are percent differences between control and treatment groups, (treatment - control)/control left in decimal form. I wondered how the cube root transform would affect fractional values. If I have a small fraction, e.g. 0.008, the cube root transform would convert it to 0.2, and 0.1 becomes 0.46. After transformation, 0.008 (a 0.8% change) looks like a 20% change, when the original value is close to and may in reality be zero.

The discussion at How to transform negative values to logarithms? explains the advantages of the cube root transform, but I was hoping to apply it to fractions.

I am hoping to scale the data in preparation for a heat map of the values. Alternately, are there common transformations for heat maps that address issues of scale as well as zero, negative, and fractional values? Thank you for your help.

Edit: Here is the original data enter image description here

I'd like to visualize the difference in the amount of a specific marker (1 through 6) between a treatment (1 through 7) and its respective control. I wanted to transform the original data because the signal from the two outliers, 4.8 and -1.7, drown out that of the other values on the heat map. I've tried doing z-score [(cell - row mean)/row s.d.] and min-max standardization [(cell - row min)/(row max - row min)], but these standardization rely on aggregating row values, which may not be appropriate for readouts of distinct markers for the same treatment. In fact, the standardization can lead to illogical results such as the rightmost cell of the first row (original value of 0.01) turning -0.6 after z-scoring.

  • 2
    $\begingroup$ Welcome to Cross Validated! Why do any kind of transformation? $\endgroup$
    – Dave
    Commented Feb 18, 2023 at 19:52
  • 3
    $\begingroup$ I don't understand what your question is about cube root transformations for fractional values. ... It would work the same way as for whole numbers. Perhaps look at a vector of numbers, A = (0,1,1,2,2,2,2,3,3,4,4,5,5,6,7,10,20) and apply a cube root transformation, and then B = A / 100. and apply a cube root transformation to B. $\endgroup$ Commented Feb 18, 2023 at 20:11
  • 1
    $\begingroup$ What do you hope to accomplish using a cube root (or any) transformation? $\endgroup$
    – Alexis
    Commented Feb 18, 2023 at 20:15
  • 1
    $\begingroup$ Think carefully about whether a heat map of transformed percentage differences is the best way to display your results. See Frank Harrell's discussion about the confusions that arise with percentages. Consider editing the question to describe the data that you have, the analysis that you have done so far, and what you would like to convey to your audience. You might get useful suggestions about better ways to proceed than with a cube-root transformation of percentage differences. $\endgroup$
    – EdM
    Commented Feb 18, 2023 at 21:00
  • 1
    $\begingroup$ @whuber, thank you so much. The log of the ratio of Treatment over Control works well. $\endgroup$ Commented Feb 19, 2023 at 19:52

1 Answer 1


First, if what you show are the percentage changes from a control for each of the treatments, then those aren't the original data. You've already calculated something like $100 \space (T-C)/C$ from the original data under T and C conditions. As Frank Harrell's blog describes, working with percentage changes can lead to unnecessary confusion. One of my objections is that working with fractional or percentage changes implicitly assumes that you have a highly precise value for the C condition used as the reference. More typically, both T and C conditions lead to similar-magnitude errors in observed values.

Second, a standard way to deal with this, as suggested by @whuber in a comment, is to evaluate the change of original observations (not fractional changes) between conditions on a log scale: $\log T - \log C$, which is the log of the $T/C$ ratio. In the log scale, the two conditions are treated equivalently. With the low percentage changes in this particular data set I think that the relative numbers in log scale differences would be close to what you show (with all divided by 100), but in general that's preferable to looking at percentage changes.

Third, the different distortions below and above absolute values of 1 with the cube-root transformation are precisely what allow you to minimize the visual impact of the "outliers" with your proposed approach. You describe some of your worries in terms of apparent distortions in percentage changes. See the first point above: thinking in terms of percentage changes tends to get you into trouble.

Fourth, almost all of the percentage changes here are extremely small. Without knowledge of your subject matter, I would probably want to emphasize what you call "outliers": those are the cases where the marker is most substantially associated with differences in treatments. Even if a fractional change of 0.008 is "statistically significant," is it practically significant? Answering that requires applying your knowledge of the subject matter.

Fifth, it's very important to show the variability of the values in some way, not just the values themselves. Boxplots of the original individual marker observations as functions of treatment (including the control treatment and before adjusting for control; maybe on a log scale) could be more useful to your audience than a heat map. They illustrate both point estimates and variability among measurements.

Sixth, if you do want a heat map, there is no need for a simple functional association between numeric values and heat-map colors. The breaks argument to the R image() function, which is called by the heatmap() function, lets you specify the values at which colors change. You don't have to depend on the default. Make sure that you show and explain your choices, however.

  • $\begingroup$ Thank you so much for your thoughtful and thorough response, @EdM. The log of ratios worked well. To clarify, I should have said fractional change instead of percent change. I didn't multiply by 100. Thank you again. $\endgroup$ Commented Feb 19, 2023 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.