Hello everyone,
I'm looking at the Drawdown functions from the PerformanceAnalytics package
and I just don't get it.
The docs say that the input should be Asset Returns and the output will be
drawdown levels as percentages but if I call them with a simple return
series I don't get what I expect.
For instance: if I have a simple returns series like c(0, 10, -10, -1, 1, 2)
I would expect the maximum drawdown to be -11 (or 110%), but instead I get:
> library(PerformanceAnalytics)
> maxDrawdown(xts(c(0, 10, -10, -1, 1, 2), Sys.Date()-6:1), geometric=T)
[1] 10
Changing the geometric parameter to False also gives me not what I would
expect:
> maxDrawdown(xts(c(0, 10, -10, -1, 1, 2), Sys.Date()-6:1), geometric=F)
[1] 1
findDrawdowns() gives me an error:
> findDrawdowns(xts(c(0, 10, -10, -1, 1, 2), Sys.Date()-6:1), geometric=T)
Error in if (drawdowns[i] < sofar) { : argument is of length zero
Here is my sessionInfo()
> sessionInfo()
R version 2.11.1 (2010-05-31)
i486-pc-linux-gnu
locale:
[1] LC_CTYPE=en_US.utf8 LC_NUMERIC=C LC_TIME=en_US.utf8
LC_COLLATE=en_US.utf8 LC_MONETARY=C
[6] LC_MESSAGES=en_US.utf8 LC_PAPER=en_US.utf8 LC_NAME=C
LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] fTrading_2100.76 fBasics_2110.79 MASS_7.3-5
timeSeries_2120.89 timeDate_2120.90
[6] XML_3.1-1 quantmod_0.3-14 TTR_0.20-2
Defaults_1.1-1 PerformanceAnalytics_1.0.3
[11] xts_0.7-5 zoo_1.6-4
loaded via a namespace (and not attached):
[1] grid_2.11.1 lattice_0.18-8 tools_2.11.1
Can someone explain the unexpected results or is it just broken?
Thanks,
-Mark-
[[alternative HTML version deleted]]
_______________________________________________
[email protected] 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.