Return.calculate {PerformanceAnalytics}R Documentation

calculate simple or compound returns from prices

Description

calculate simple or compound returns from prices

Usage

Return.calculate(prices, method=c("compound","simple"))
CalculateReturns(prices, method=c("compound","simple"))

Arguments

prices data object containing ordered price observations
method calculate "simple" or "compound" returns, default compound

Details

Two requirements should be made clear. First, the function 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, to.period in the xts package, or the aggregate.zoo in the 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 quote="AdjClose" in get.hist.quote, which is found in package tseries.

Value

vector or matrix of simple or compound returns

Author(s)

Peter Carl

References

Bacon, C. Practical Portfolio Performance Measurement and Attribution. Wiley. 2004. Chapter 2

See Also

Return.cumulative

Examples

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")

[Package PerformanceAnalytics version 0.9.9-5 Index]