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
.
We have changes the default arguments and settings for method
from compound
and simple
to discrete
and
log
and discrete
to avoid confusing between the return type
and the chaining method. In most of the rest of PerformanceAnalytics
,
compound and simple are used to refer to the return chaining method used for the returns.
The default for this function is to use discrete returns, because most other package
functions use compound chaining by default.