1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
\name{drawdowns}
\alias{drawdowns}
\alias{drawdownsStats}
\title{Calculations of drawdowns}
\description{
Compute series of drawdowns from financial returns and calculate
drawdown statisitcs.
}
\usage{
drawdowns(x, \dots)
drawdownsStats(x, \dots)
}
\arguments{
\item{x}{
a \code{"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.
}
\item{\dots}{
optional arguments passed to \code{na.omit}.
}
}
\value{
for \code{drawdowns}, an object of class \code{timeSeries}.
for \code{drawdownsStats} an object of
class \code{"data.frame"} with the following components:
\item{drawdown}{the depth of the drawdown, }
\item{from}{the start date, }
\item{trough}{the trough period, }
\item{to}{the end date, }
\item{length}{the length in number of records, }
\item{peaktrough}{the peak trough, and }
\item{recovery}{the recovery length in number of records.}
}
\details{
The code in the core of the function \code{drawdownsStats}
was borrowed from the package \code{PerformanceAnalytics}
authored by Peter Carl and Sankalp Upadhyay.
}
\author{
Peter Carl and Sankalp Upadhyay for code from the contributed R
package \code{PerformanceAnalytics} used in the function
\code{drawdownsStats}.
}
\seealso{
\code{\link{returns}},
\code{\link{cumulated}},
%\code{\link{drawdowns}},
\code{\link{splits}},
%\code{\link{spreads}},
\code{\link{midquotes}},
\code{\link{index2wealth}}
}
\examples{
## 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)
}
\keyword{chron}
|