Calculations of Drawdowns

Share:

Description

Compute series of drawdowns from financial returns and calculate drawdown statisitcs.

Usage

1
2
3

Arguments

x

a 'timeSeries' object of financial returns. Note, drawdowns can be calculated from an uni- or multivariate time deries object, statistics can only be computed from an univariate time series object.

...

optional arguments passed to the function na.omit.

Details

The code in the core of the function drawdownsStats was was borrowed from the package PerformanceAnalytics authored by Peter Carl and Sankalp Upadhyay.

Value

drawdowns
returns an object of class 'timeSeries'.

drawdownsStats
returns an object of class 'data.frame' with the following entries:
"drawdown" - the depth of the drawdown,
"from" - the start date,
"trough" - the trough period,
"to" - the end date,
"length" - the length in number of records,
"peaktrough" - the peak trough, and ,
"recovery" - the recovery length in number of records.

Author(s)

Peter Carl and Sankalp Upadhyay for code from the contributed R package PerformanceAnalytics used in the function drawdownsStats.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Use Swiss Pension Fund Data Set of Returns - 
   head(LPP2005REC)
   SPI <- LPP2005REC[, "SPI"]
   head(SPI)
   
## Plot Drawdowns - 
   dd = drawdowns(LPP2005REC[, "SPI"], main = "Drawdowns")
   plot(dd)
   dd = drawdowns(LPP2005REC[, 1:6], main = "Drawdowns")
   plot(dd)

## Compute Drawdowns Statistics - 
   ddStats <- drawdownsStats(SPI)
   class(ddStats)
   ddStats
   
## Note, Only Univariate Series are allowd -
   ddStats <- try(drawdownsStats(LPP2005REC))
   class(ddStats)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.