Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a time-series list of stockA, which I call bas. I have taken the natural log of bas by using


As you you know this gives the natural log of each number in the time-series list. This is what I want to do now

OPR = Log[bas/(bas at t-1)]*100 

How can I get this?

share|improve this question
up vote 3 down vote accepted

You can do this:

bas = FinancialData["MSFT", {DatePlus[Date[], -365], Date[]}, "Value"]
(* Here bas is defined as the time-series of prices for Microsoft (ticker: MSFT) *)

Now you can compute the log-returns:

share|improve this answer
This was actually done in my class, the teacher stated that you simply take the list of values and then divide that list with the same list at point t-1. I do understand the log of it but I dont understand how t-1 is conducted. – ALEXANDER Aug 21 '13 at 11:37
@ALEXANDER There are many types of returns... nominal return is defined as $R_{t}=\dfrac{P_{t}-P_{t-1}}{P_{t-1}}$. However, log-returns are defined as the logarithm of the price differences (or simply the logarithm of the norminal returns). So, $LogRet_{t}=Log(R_{t})=Log(\dfrac{P_{t}-P_{t-1}}{P_{t-1}})=Log(\dfrac{P_{t}}{P_{‌​t-1}})$ – Rod Aug 21 '13 at 11:40
Okey what if i ask this question. I want to divide list ss of shareprices by list ss of shareprices at time t-1. how would you do this, the teacher talked about the fact that since it is now at t-1 you would lose the value of the first row of the list. Not sure what she meant about that. – ALEXANDER Aug 21 '13 at 11:48
@Alexander That's correct! If you have a price time-series with n elements you will always get n-1 returns. You can check that by using Length[bas] and Length[Differences[Log[bas]]]. I get 250 prices and 249 returns. – Rod Aug 21 '13 at 11:50
Okey, sounds good. But how do you subtract one values in one list from the other list? – ALEXANDER Aug 21 '13 at 11:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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