# [R-SIG-Finance] Calculating returns on negative time series

Johnson, Cedrick W. cedrick at cedrickjohnson.com
Wed Oct 27 19:17:36 CEST 2010

```I concur; I was approaching this particular problem from the wrong way
and this helps clarify things a great bit.

Thanks for clarity on this on behalf of my foggy brain today

-c

On 10/27/2010 1:11 PM, Patrick Burns wrote:
> Okay.  The thing about returns is that
> they are about *money*.  The return
> over a period of time is a function of
> two values:
> * the amount of money to buy
> * the amount of money to sell
>
> I don't think that is what you have in
>
> On 27/10/2010 17:51, Johnson, Cedrick W. wrote:
>> I'll look into the materials at the post in more detail shortly, much
>> appreciated.
>>
>> On the series, I could either be long or short. Meaning:
>>
>> "long" at -117, if it jumps to -122 i've lost -5. Conversely, "short"
>> -117 and it jumps to -122 +5.
>>
>> I hope I explained it well, as I said i'll check the link and do some
>> more digging.
>>
>> regards,
>> c
>>
>> On 10/27/2010 12:38 PM, Patrick Burns wrote:
>>> The post:
>>> http://www.portfolioprobe.com/2010/10/04/a-tale-of-two-returns/
>>>
>>> you are using negative values to mean "short".
>>> Correct?
>>>
>>> explain the negative part more thoroughly please?
>>>
>>> On 27/10/2010 16:54, Johnson, Cedrick W. wrote:
>>>> Howdy-
>>>>
>>>> I *know* I've seen it discussed before on the list, and I've tried to
>>>> search through all my emails and the archives for it so forgive me for
>>>> reposting (perhaps I'm using the improper search terms).
>>>>
>>>> To calculate the simple returns for a time series above 0, no brainer:
>>>>
>>>> I'm using the Return.calculate function to calculate these
>>>> (method="simple")
>>>>
>>>> Things get a little tricky when I throw in time series that are
>>>> negative
>>>>
>>>> x =
>>>> c(-117,-122,-129,-129,-134,-136,-136,-140,-143,-143,-143.2,-146.7,-145.8,-143,-141.2,-137.7,-135.5,-133.6)
>>>>
>>>>
>>>>
>>>>
>>>> NaN's are produced when trying to get a "return" time series. I
>>>> seem to
>>>> recall doing this
>>>>
>>>> xa = abs(x)
>>>> Return.calculate(xa)
>>>>
>>>> 2 0.041847110
>>>> 3 0.055791360
>>>> 4 0.000000000
>>>> 5 0.038027396
>>>> 6 0.014815086
>>>> 7 0.000000000
>>>> 8 0.028987537
>>>> 9 0.021202208
>>>> 10 0.000000000
>>>> 11 0.001397624
>>>> 12 0.024147431
>>>> 13 -0.006153866
>>>> 14 -0.019391189
>>>> 15 -0.012667305
>>>> 16 -0.025099919
>>>> 17 -0.016105765
>>>> 18 -0.014121379
>>>>
>>>> I am thinking that I could take the abs value, once I get the return
>>>> series just invert it by multiplying by -1. I'm concerned that
>>>> something
>>>> could be thrown off by a series that's changing from lets say 1,0,-1
>>>> (puking on the 0).
>>>>
>>>> Can someone point me to anything that addresses this? Not sure the
>>>> "solution" i outlined above is the proper way to handle this.
>>>>
>>>> -c
>>>>
>>>> _______________________________________________
>>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>>> -- Subscriber-posting only. If you want to post, subscribe first.
>>>> -- Also note that this is not the r-help list where general R
>>>> questions
>>>> should go.
>>>>
>>>
>>
>>
>

```