Calculating returns on negative time series
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/ may or may not answer your question. If it does answer your question, then I suspect you are using negative values to mean "short". Correct? If it does not answer your question, then can you 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 (such as spreads): 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.