\HeaderA{UpDownRatios}{calculate metrics on up and down markets for the benchmark asset}{UpDownRatios}
\keyword{ts}{UpDownRatios}
\keyword{multivariate}{UpDownRatios}
\keyword{distribution}{UpDownRatios}
\keyword{models}{UpDownRatios}
\begin{Description}\relax
Calculate metrics on how the asset in R performed in up and down markets, measured by periods when the benchmark asset was up or down.
\end{Description}
\begin{Usage}
\begin{verbatim}
UpDownRatios(Ra, Rb, method = c("Capture", "Number", "Percent"), side = c("Up", "Down"))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{Ra}] an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns 
\item[\code{Rb}] return vector of the benchmark asset 
\item[\code{method}] "Capture", "Number", or "Percent" to indicate which measure to return 
\item[\code{side}] "Up" or "Down" market statistics 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This is a function designed to calculate several related metrics:

Up (Down) Capture Ratio: this is a measure of an investment's compound return when the benchmark was up (down) divided by the benchmark's compound return when the benchmark was up (down). The greater (lower) the value, the better.

Up (Down) Number Ratio: similarly, this is a measure of the number of periods that the investment was up (down) when the benchmark was up (down), divided by the number of periods that the Benchmark was up (down).

Up (Down) Percentage Ratio: this is a measure of the number of periods that the investment outperformed the benchmark when the benchmark was up (down), divided by the number of periods that the benchmark was up (down). Unlike the prior two metrics, in both cases a higher value is better.
\end{Details}
\begin{Value}
A numeric value for each calculation.
\end{Value}
\begin{Author}\relax
Peter Carl
\end{Author}
\begin{References}\relax
Bacon, C. \emph{Practical Portfolio Performance Measurement and Attribution}. Wiley. 2004. p. 47 \\
\end{References}
\begin{Examples}
\begin{ExampleCode}
data(managers)
UpDownRatios(managers[,1, drop=FALSE], managers[,8, drop=FALSE])
UpDownRatios(managers[,1:6, drop=FALSE], managers[,8, drop=FALSE])
UpDownRatios(managers[,1, drop=FALSE], managers[,8, drop=FALSE], method="Capture")
# Up Capture:
UpDownRatios(managers[,1, drop=FALSE], managers[,8, drop=FALSE], side="Up", method="Capture")
# Down Capture:
UpDownRatios(managers[,1, drop=FALSE], managers[,8, drop=FALSE], side="Down", method="Capture")

\end{ExampleCode}
\end{Examples}

