drawdowns {PMwR} | R Documentation |
Compute Drawdowns
Description
Compute drawdown statistics.
Usage
drawdowns(x, ...)
## Default S3 method:
drawdowns(x, ...)
## S3 method for class 'zoo'
drawdowns(x, ...)
Arguments
x |
a |
... |
additional arguments, to be passed to methods |
Details
drawdowns
is a generic function. It computes drawdown
statistics: maximum; and time of peak, trough and recovery.
Value
a data.frame
:
peak |
peak before drawdown |
trough |
lowest point |
recover |
new high or |
max |
the max drawdown |
Author(s)
Enrico Schumann
References
Gilli, M., Maringer, D. and Schumann, E. (2019) Numerical Methods and Optimization in Finance. 2nd edition. Elsevier. doi:10.1016/C2017-0-01621-X
Schumann, E. (2023) Portfolio Management with R.
https://enricoschumann.net/PMwR/;
in particular,
https://enricoschumann.net/R/packages/PMwR/manual/PMwR.html#drawdowns-streaks
See Also
The actual computation of the drawdowns is done by function
drawdown
in package NMOF.
Series of uninterrupted up and down movements can be
computed with streaks
.
Examples
x <- c(100, 98)
drawdowns(x)
x <- c(100, 98, 102, 99)
dd <- drawdowns(x)
dd[order(dd$max, decreasing = TRUE), ]