# Using Log when working with a time-series

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

LOG[bas]


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?

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:

Differences[Log[bas]]

• 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