I would like to know how to transform negative values to Log()
, since I have heteroskedastic data. I read that it works with the formula Log(x+1)
but this doesn't work with my database and I continue getting NaNs as result. E.g. I get this Warning message (I didn't put my complete database because I think with one of my negative values is enough to show an example):
> log(-1.27+1)
[1] NaN
Warning message:
In log(-1.27 + 1) : NaNs produced
>
Thanks in advance
UPDATE:
Here is an histogram of my data. I'm working with palaeontological time series of chemical measurements, E.g the difference between variables like Ca and Zn is too big, then I need some type of data standardization, that is why I'm testing the log()
function.
This is my raw data
log(x+1)
transformation will is only defined forx > -1
, as thenx + 1
is positive. It'd be good to know your reason for wanting to log transform your data. $\endgroup$sign(x) * (abs(x))^(1/3)
, the details depending on software syntax. For more on cube roots see e.g. stata-journal.com/sjpdf.html?articlenum=st0223 (see esp. pp.152-3).We used cube roots to help visualization of a response variable that can be positive and negative in nature.com/nature/journal/v500/n7464/full/… $\endgroup$