Peter Carl
http://www.braverock.com/peter
> Hi,
>
> If you have a look to the function chart.CumReturns, the line
>
> ? column.Return.cumulative = na.skip(z,FUN = function(x, one, geometric)
> {if(geometric) cumprod(x)-one else (1-one) + cumsum(x-1)},one=one,
> geometric=geometric)
> should be
> ? column.Return.cumulative = na.skip(z,FUN = function(x, one, geometric)
> {if(!geometric) cumprod(x)-one else (1-one) + cumsum(x-1)},one=one,
> geometric=geometric)
> where z = 1 + x[,column]
>
>
> because, for discrete return, the cumulative return should be
> cumprod(1+R)-1 and for the continuous one is exp(cumsum(R)) ( R =
> na.omit(R))
>
> Chris.
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org 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.