Return.calculate: calculate simple or compound returns from prices

View source: R/Return.calculate.R

Return.calculateR Documentation

calculate simple or compound returns from prices

Description

calculate simple or compound returns from prices

Usage

Return.calculate(prices, method = c("discrete", "log", "difference"))

CalculateReturns(prices, method = c("discrete", "log"))

Arguments

prices

data object containing ordered price observations

method

calculate "discrete" or "log" returns, default discrete(simple)

Details

Two requirements should be made clear. First, the function Return.calculate assumes regular price data. In the example, 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 aggregate.zoo in the zoo package support management and conversion of irregular time series to regular 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, or use the Ad function.

We have changed the default arguments and settings for method from compound and simple to discrete and log an difference to avoid confusion between the return type (discrete, log, difference) and the chaining method (compound or arithmetic/simple). In most of the rest of PerformanceAnalytics, compound and simple are used to refer to the return chaining method which is used with the returns. The default for this function is to use discrete returns, because most other package functions use compound chaining by default.

Other method argument formulations also work for clarity and backwards compatibility:

method='discrete' has equivalent arguments simple and arithmetic

method='log' has equivalent argument compound and continuous

method='difference' has equivalent argument diff

Author(s)

Peter Carl

References

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

See Also

Return.cumulative

Examples


  ## Not run: 
    require(quantmod)
    prices = Cl(getSymbols("IBM", from = "1999-01-01", to = "2007-01-01"))
  
## End(Not run)
  
R.IBM = Return.calculate(xts(prices), method="discrete")
colnames(R.IBM)="IBM"
chart.CumReturns(R.IBM,legend.loc="topleft", main="Cumulative Daily Returns for IBM")
round(R.IBM,2)

braverock/PerformanceAnalytics documentation built on Feb. 16, 2024, 5:37 a.m.