[R-SIG-Finance] validation of DrawdownPeak in PerformanceAnalytics package
Charles Duranceau
cduranceau at nial.ky
Tue Mar 24 00:05:32 CET 2015
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]]
More information about the R-SIG-Finance
mailing list