Level.calculate: Calculate appropriate cumulative return series or asset level...

Description Usage Arguments Details Author(s) See Also

View source: R/Level.calculate.R

Description

This function calculates the time varying index level over the entire period of available data. It will work with arithmetic or log returns, using attribute information from an xts object. If the first value in the left-most column is NA, it will be populated with the seedValue. However, if the first value in the left-most column is not NA, the previous date will be estimated based on the periodicity of the time series, and be populated with the seedValue. This is so that information is not lost in case levels are converted back to returns (where the first value would result in an NA). Note: previous date does not consider weekdays or holidays, it will simply calculate the previous calendar day. If the user has a preference, they should ensure that the first row has the appropriate time index with an NA value. If users run Return.calculate() from this package, this will be a non-issue.

Usage

1
Level.calculate(R, seedValue = NULL, initial = TRUE)

Arguments

R

an xts object

seedValue

a numeric scalar indicating the (usually initial) index level or price of the series

initial

(default TRUE) a TRUE/FALSE flag associated with 'seedValue', indicating if this value is at the begginning of the series (TRUE) or at the end of the series (FALSE)

Details

Product of all the individual period returns

For arithmetic returns:

cumprod(1+R)

For log returns:

exp(cumsum(R))

Author(s)

Erol Biceroglu

See Also

Return.calculate


PerformanceAnalytics documentation built on Feb. 6, 2020, 5:11 p.m.