[R-SIG-Finance] How to get chart.CumReturns to return dataframe of cumulative returns

Brian G. Peterson brian at braverock.com
Thu Sep 4 21:47:19 CEST 2014


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



More information about the R-SIG-Finance mailing list