Hi Peter, Yes that works. Thank you I found also easier working directly with "table.Drawdowns" but wanted to understand the building blocks.
Cheers -----Original Message----- From: Peter Carl [mailto:pe...@braverock.com] Sent: Monday, March 23, 2015 6:48 PM To: Charles Duranceau; r-sig-finance@r-project.org Subject: Re: [R-SIG-Finance] validation of DrawdownPeak in PerformanceAnalytics package Charles, DrawdownPeak probably shouldn't be in the namespace - thanks for pointing it out. You might be looking for PerformanceAnalytics:::Drawdowns, which probably *should* be in the namespace. Let me know if that works for you. pcc On 03/23/2015 06:05 PM, Charles Duranceau wrote: > Hi, > I'm looking at the results returned by the function DrawdownPeak and struggle > to understand the calculation. > In the following example, I recalculate the return from drawdown and for the > third period I found a difference (I'm aware the formula I'm using is only > local for the example). > I expect using "geometric" rule for aggregating returns but cannot > match the calculations > > In this example the peak is 10% and the returns for the next 2 period > are -2% and -1% which should lead to a cumulative return of (1.1 / > 1.078 / 1.06722) > > Q1. The return for the 3rd period from Peak should then be : 1.06722 / > 1.10 -1 = 2.98% and not 2.9998%. Is the result I should expect? (it looks > like the it does not compound when "geometric=TRUE") Q2. I noticed that > "geometric=TRUE" option does not make any difference. Is this expected? > Q3. Finally I was not able to standardized the decimal with > options(digits=4). Is this normal? > > Code for replication > > library("PerformanceAnalytics") > ret_num<-c(0.10,-0.020,-0.010) > # simulated returns - the peak is the first observations > ret_test<-xts(ret_num, Sys.Date()-3:1) # > return in xts class > ddtp_test<-DrawdownPeak(ret_test,geometric=TRUE) # results for > return for drawdowns to validate > cret_num<-cumprod(1+ret_num)-1 # > validation by cumulative returns > ddtp_vet<-(1+cret_num)/(1+cret_num[1])-1 # replication of > cumulative returns for drawdowns > cbind(ddtp_test,ddtp_vet) # to > compare results - differences > > The third row shows a difference - look small bu > ddtp_test ddtp_vet > [1,] 0.000000 0.0000 > [2,] -0.020000 -0.0200 > [3,] -0.029998 -0.0298 > > > This looks small (not related to rounding) but in other cases the difference > was more important and lead to difference in the drawdown period. > I reproduced the same values with version 3.1 and version 3.1.3 > > > Package PerformanceAnalytics (1.4.3579) loaded. > > version.string R version 3.1.3 (2015-03-09) > > > > > > > > Thank you > Best Regards, > > Charles > > > > [[alternative HTML version deleted]] > > _______________________________________________ > R-SIG-Finance@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. > -- Peter Carl 312.307.6346 _______________________________________________ R-SIG-Finance@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.