4
$\begingroup$

I would like to plot two time-series on a same graph. One series takes much larger values than the other, so I thought a semilog scale might be appropriate (i.e. linear X (dates) and log Y). However, both series take on negative and positive values. Does it still make sense to use a log scale? If so, should I transform both series as follows?

    if observation > 0
        log_observation = log(observation)
    elseif observation < 0
        log_observation = -log(-observation)
    else
        log_observation = 0
$\endgroup$
4
  • 1
    $\begingroup$ Because whether and how to transform data depends on their characteristics (more than their signs!) and on the purpose of the transformation, please give us more information about both so that this can be an objectively answerable question. $\endgroup$
    – whuber
    Nov 24, 2012 at 17:03
  • $\begingroup$ The time-series are the returns in dollar vs. percent terms of a trading strategy over time. $\endgroup$
    – lodhb
    Nov 25, 2012 at 10:58
  • 1
    $\begingroup$ Why don't you show them as-is, using two different vertical axes to put the two series on the same graph? $\endgroup$
    – whuber
    Nov 25, 2012 at 16:31
  • 1
    $\begingroup$ So linear with two different y-axes? That is a good suggestion, I'll try it out. The only downside is that you don't have a single axis to compare both time-series on, but at least the graph will show correlation quite well. $\endgroup$
    – lodhb
    Nov 25, 2012 at 21:46

1 Answer 1

2
$\begingroup$

you might want to use a different transformation. The inverse hyerperbolic sine transform would seem to be a good first choice here.

$\endgroup$
2
  • 1
    $\begingroup$ Another choice is the cube root. $\endgroup$
    – Peter Flom
    Nov 24, 2012 at 15:09
  • $\begingroup$ Beware that cube roots in naïve python (**(1/3)) don't handle negative numbers, either (although numpy.cbrt does). $\endgroup$
    – ijoseph
    Jun 19, 2018 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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