Return.calculate    package:PerformanceAnalytics    R Documentation

_c_a_l_c_u_l_a_t_e _s_i_m_p_l_e _o_r _c_o_m_p_o_u_n_d _r_e_t_u_r_n_s _f_r_o_m _p_r_i_c_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     calculate simple or compound returns from prices

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

  prices: data object containing ordered price observations 

  method: calculate "simple" or "compound" returns, default compound 

_D_e_t_a_i_l_s:

     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'.

_V_a_l_u_e:

     vector or matrix of simple or compound returns

_A_u_t_h_o_r(_s):

     Peter Carl

_R_e_f_e_r_e_n_c_e_s:

     Bacon, C. _Practical Portfolio Performance Measurement and
     Attribution_. Wiley. 2004. Chapter 2 

_S_e_e _A_l_s_o:

     'Return.cumulative'

_E_x_a_m_p_l_e_s:

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

