-1
$\begingroup$

I am currently doing log differences to a dataset and I want to revert back to the actual values. I'm trying to understand why at the end we need to multiply by the original value (and why we do not add)?

The columns in blue demonstrate how I am finding the log difference, and the columns in orange show how I revert back to the original time series. See attached picture.

Any explanations would be appreciated, Cheers. Sample Data Demonstrating Question

$\endgroup$
6
  • 3
    $\begingroup$ The table is not making much sense, ln(5) = 1.609... and by definition exp(ln(5)) should be 5, not NaN. $\endgroup$
    – Three Diag
    Commented Nov 24, 2020 at 22:02
  • 1
    $\begingroup$ Your mistake is that the cumulative sum should begin with the first value, not with NaN. $\endgroup$
    – whuber
    Commented Nov 24, 2020 at 22:04
  • $\begingroup$ You're correct, I think what it should be is: exp(ln(x-x0). Where I have exp(logx), Im actually applying the exp() function to the Cumulative Sum column. Essentially, I take the log of the column and the calculate the differences. I then try to reverse the steps... $\endgroup$
    – Antonio
    Commented Nov 24, 2020 at 22:07
  • $\begingroup$ @whuber - Ah I see what you mean, that would indeed solve the problem. However I'm trying to understand why we have to do the multiplication step (last column), when we do not do your suggestion? $\endgroup$
    – Antonio
    Commented Nov 24, 2020 at 22:10
  • 1
    $\begingroup$ Because your NaN obliterates all information about the first value. $\endgroup$
    – whuber
    Commented Nov 24, 2020 at 22:12

1 Answer 1

-2
$\begingroup$

The column logx(Cumulative Sum) seems to be your source of confusion, even though it is not even needed to compute exp(logx) or the last column. In other words, the first orange column is not needed to revert back to the original time series x, unless you meant to imply that it is actually a data-given blue column. For example,

$$e^{\ln x} = e^{\ln 4} \neq 0.8$$

because the exponential cancels the logarithm according to the rule $e^{\ln x} = x$. Instead, $$e^{\ln x} = e^{\ln 4} = 4$$

already. Had you spotted this obvious mistake in the second orange column, you wouldn't need to start questioning why the calculation of the third orange column isn't working how you expect it to. You're just feeding mistakes down the chain, what do you expect

$\endgroup$

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.