I have a bunch of data that's both positive and negative. Its calculated from the residuals of an ANOVA (i.e. specific leaf area calculated as the residuals of an ANOVA of leaf area with leaf blade weight). Right now the data is not homoscedastic or normal. Since I can't log negative numbers I'm unsure of how to make the data normal or homoscedastic. Could I square the residuals and then log them? Should I use the logs of leaf area and leaf blade weight to calculate the specific leaf area? I believe they were homoscedastic. Any help would be appreciated.
2 Answers
I think we need much more context on what you did and why you think you need to make these values more nearly normal. It is possible that you need to focus on developing a different model, not massaging the results of a model that is not quite satisfactory.
On a mechanistic level, cube roots act symmetrically on a variable that is positive, zero and negative and may pull in the tails of a distribution that is approximately symmetric but heavier-tailed than Gaussian or normal. I have sometimes found this useful for raw data. Note that in most software you need to do something like
sign(x) * abs(x)^(1/3)
because powering will just give missings for negative values. More at e.g. http://www.stata-journal.com/sjpdf.html?articlenum=st0223
More esoteric functions can be suggested to do this e.g. the neglog function or some inverse hyperbolic function, but the cube root is simpler in the sense that it is met earlier in one's mathematical training.
I've not found reason to do this with residuals, however.
EDIT 2022 I feel more positive about neglog, which although ad hoc (meaning positively, fit for purpose) has behaviour that often seems about right, i.e. it is like $\log x$ for $x \gg 0$, like $x$ for $x \approx 0$ and like $-\log (-x)$ for $x \ll 0$.
All the transformations here have good properties, including
being symmetric in that $T(-x) = -T(x)$ for any transformation $T()$
preserving sign (linked to the previous property), so $\text{sign}(T(x)) = \text{sign}(x)$
being steepest at zero
having easy derivatives.
If you want to apply a transformation that requires strictly positive numbers (e.g. a log transformation) and your data does not meet that requirement, a common approach is to add a constant to the data before applying the transformation so that after adding the constant all your data is greater than zero.
x_transformed = log(x + C)
where C
is a constant that allows x+C
to be greater than zero. E.g., C = 1 - min(x)
.
See also Box-Cox transformation.
-
2$\begingroup$ This is unlikely to normalise a variable that is residual-like and both positive and negative as it doesn't act symmetrically. $\endgroup$– Nick CoxCommented Apr 22, 2014 at 8:21