On 09/04/2014 02:38 PM, George Kumar wrote:
Hi all,

I am using PerformanceAnalytics package
and specifically the function

chart.CumReturns. This works fine. But my question
is suppose instead of plotting the data I would like
chart.CumReturns to return me a table/data frame of values.

I realize that I can use cumsum function

df.cumsum = apply(df,2,cumsum)

but this only gives me arithmetic sum, whereas I would prefer geometric

cumulative return and chart.CumReturns seem to do a good job
in returning that information.

use cumprod instead of cumsum.

Since cumprod and cumsum are core R functions, we didn't see a need to create a function in PerformanceAnalytics for it.

Alternately, Return.portfolio will also do what you want, and return a time series of cumulative returns if wealth.index=TRUE

Regards,

Brian

--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

_______________________________________________
[email protected] 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.

Reply via email to