An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120822/e73d1307/attachment.pl>
Bug in chart.CumReturns (PerformanceAnalytics)
5 messages · Chris de Bleu, Peter Carl, G See
The "arithmetic" and "geometric" tags (indicated as geometric=TRUE or
FALSE) are used not for the returns themselves, but the *chaining method*
used in the calculation. (I think the documentation says "simple" instead
of "arithmetic"). Part of the confusion is that the language people are
using in the literature is slightly different than what I adopted at the
beginning, and it could be changed to be more clear. Also, geometric ==
compound.
Perhaps we should use chaining.method=c("geometric", "simple") for all of
these functions in a future version. Alternatively, we could use
returns.type=c("simple", "log") and provide the transformed returns from
the "log" case, although somewhat I'm reluctant to do that across the
whole package.
pcc
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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120822/6eb4346a/attachment.pl>
Correct, if you have simple returns, set geometric=TRUE. pcc
Peter Carl http://www.braverock.com/peter > Call it what you want but for a simple (arithematic or geometric = FALSE) > return, the equity curve should be cumprod(1+R) not cumsum(R). > > C. > > > > ________________________________ > De?: Peter Carl <peter at braverock.com> > ??: Chris de Bleu <blue2bleu at yahoo.fr> > Cc?: "r-sig-finance at r-project.org" <r-sig-finance at r-project.org> > Envoy? le : Mercredi 22 ao?t 2012 22h55 > Objet?: Re: [R-SIG-Finance] Bug in chart.CumReturns (PerformanceAnalytics) > > The "arithmetic" and "geometric" tags (indicated as geometric=TRUE or > FALSE) are used not for the returns themselves, but the *chaining method* > used in the calculation.? (I think the documentation says "simple" instead > of "arithmetic").? Part of the confusion is that the language people are > using in the literature is slightly different than what I adopted at the > beginning, and it could be changed to be more clear.? Also, geometric == > compound. > > Perhaps we should use chaining.method=c("geometric", "simple") for all of > these functions in a future version.? Alternatively, we could use > returns.type=c("simple", "log") and provide the transformed returns from > the "log" case, although somewhat I'm reluctant to do that across the > whole package. > > pcc > -- > Peter Carl > http://www.braverock.com/peter
Peter, I agree that this is confusing.
From ?Return.cumulative:
"geometric generate geometric (TRUE) or simple (FALSE) returns, default TRUE" So, you use geometric=FALSE to create simple returns. Then you use geometric=TRUE if you want to chart them? Best, Garrett
On Wed, Aug 22, 2012 at 4:08 PM, Peter Carl <peter at braverock.com> wrote:
Correct, if you have simple returns, set geometric=TRUE. pcc -- Peter Carl http://www.braverock.com/peter
Call it what you want but for a simple (arithematic or geometric = FALSE) return, the equity curve should be cumprod(1+R) not cumsum(R). C.
________________________________
De : Peter Carl <peter at braverock.com>
? : Chris de Bleu <blue2bleu at yahoo.fr>
Cc : "r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
Envoy? le : Mercredi 22 ao?t 2012 22h55
Objet : Re: [R-SIG-Finance] Bug in chart.CumReturns (PerformanceAnalytics)
The "arithmetic" and "geometric" tags (indicated as geometric=TRUE or
FALSE) are used not for the returns themselves, but the *chaining method*
used in the calculation. (I think the documentation says "simple" instead
of "arithmetic"). Part of the confusion is that the language people are
using in the literature is slightly different than what I adopted at the
beginning, and it could be changed to be more clear. Also, geometric ==
compound.
Perhaps we should use chaining.method=c("geometric", "simple") for all of
these functions in a future version. Alternatively, we could use
returns.type=c("simple", "log") and provide the transformed returns from
the "log" case, although somewhat I'm reluctant to do that across the
whole package.
pcc
--
Peter Carl
http://www.braverock.com/peter
_______________________________________________ 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.