\HeaderA{Return.calculate}{calculate simple or compound returns from prices}{Return.calculate}
\aliasA{CalculateReturns}{Return.calculate}{CalculateReturns}
\keyword{ts}{Return.calculate}
\keyword{multivariate}{Return.calculate}
\keyword{distribution}{Return.calculate}
\keyword{models}{Return.calculate}
\begin{Description}\relax
calculate simple or compound returns from prices
\end{Description}
\begin{Usage}
\begin{verbatim}
Return.calculate(prices, method=c("compound","simple"))
CalculateReturns(prices, method=c("compound","simple"))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{prices}] data object containing ordered price observations 
\item[\code{method}] calculate "simple" or "compound" returns, default compound 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Two requirements should be made clear.  First, the function \code{Return.calculate} assumes regular price data.  In this case, we downloaded monthly close prices.  Prices can be for any time scale, such as daily, weekly, monthly or annual, as long as the data consists of regular observations.  Irregular observations require time period scaling to be comparable.  Fortunately, \code{\LinkA{to.period}{to.period}} in the \code{xts} package, or the \code{\LinkA{aggregate.zoo}{aggregate.zoo}} in the \code{zoo} package supports supports management and conversion of irregular time series.

Second, if corporate actions, dividends, or other adjustments such as time- or money-weighting are to be taken into account, those calculations must be made separately. This is a simple function that assumes fully adjusted close prices as input.  For the IBM timeseries in the example below, dividends and corporate actions are not contained in the "close" price series, so we end up with "price returns" instead of "total returns".  This can lead to significant underestimation of the return series over longer time periods.  To use adjusted returns, specify \code{quote="AdjClose"} in \code{\LinkA{get.hist.quote}{get.hist.quote}}, which is found in package \code{tseries}.
\end{Details}
\begin{Value}
vector or matrix of simple or compound returns
\end{Value}
\begin{Author}\relax
Peter Carl
\end{Author}
\begin{References}\relax
Bacon, C. \emph{Practical Portfolio Performance Measurement and Attribution}. Wiley. 2004. Chapter 2 \\
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{Return.cumulative}{Return.cumulative}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
require(tseries)
prices = get.hist.quote("IBM", start = "1999-01-01", end = "2007-01-01", quote = "AdjClose", compression = "d")
R.IBM = Return.calculate(prices, method="simple")
R.IBM = as.xts(R.IBM)
colnames(R.IBM)="IBM"
chart.CumReturns(R.IBM,legend.loc="topleft", main="Cumulative Daily Returns for IBM")
\end{ExampleCode}
\end{Examples}

