cumulated {timeSeries} | R Documentation |
Cumulated time series from returns
Description
Computes a cumulated financial "timeSeries"
, e.g. prices or
indexes, from financial returns.
Usage
cumulated(x, ...)
## Default S3 method:
cumulated(x, method = c("continuous", "discrete",
"compound", "simple"), percentage = FALSE, ...)
Arguments
x |
an object of class |
method |
a character string, the method for computation of returns. |
percentage |
a logical value. By default |
... |
ignored by the default method. |
Details
Note, the function cumulated
assumes as input discrete returns
from a price or index series. Only then the cumulated series agrees
with the original price or index series. The first values of the
cumulated series cannot be computed, it is assumed that the series is
indexed to 1.
Value
a "timeSeries"
object
See Also
returns
,
drawdowns
,
splits
,
midquotes
,
index2wealth
Examples
## Use the Microsofts' Close Prices Indexed to 1 -
MSFT.CL <- MSFT[, "Close"]
MSFT.CL <- MSFT.CL/MSFT[[1, "Close"]]
head(MSFT.CL)
## Compute Discrete Return -
MSFT.RET <- returns(MSFT.CL, method = "discrete")
## Cumulated Series and Compare -
MSFT.CUM <- cumulated(MSFT.RET, method = "discrete")
head(cbind(MSFT.CL, MSFT.CUM))
[Package timeSeries version 4032.109 Index]