Description Usage Arguments Value Author(s) See Also Examples
View source: R/remap.cumprod.R
This function computes the cumulative geometric values for a given zoo object.
1 | remap.cumprod(z, is.pc = FALSE, is.returns = TRUE, base = 100)
|
z |
a zoo object indexed by event time, typically by the “z.e” component obtained from “phys2eventtime” function. |
is.pc |
‘logical’, whether input is a percentage. Default value set to ‘FALSE’. |
is.returns |
‘logical’, whether input is a returns series. |
base |
an integer specifying the base for cumulative product. |
A zoo object with the cumulative product for each series, representing a buy-hold return estimate.
Chirag Anand, Vikram Bahure, Vimal Balasubramaniam
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data(StockPriceReturns)
data(SplitDates)
es.results <- phys2eventtime(z = StockPriceReturns,
events = SplitDates,
width = 5)
es.w <- window(es.results$z.e, start = -5, end = +5)
eventtime <- remap.cumprod(es.w,
is.pc = TRUE,
is.returns = TRUE,
base = 100)
print(eventtime[as.character(-3:3), ])
|
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: xts
6 9 16 20 21 22
-3 98.36845 99.93593 101.51072 97.47773 102.00284 101.37269
-2 96.66583 99.13601 101.19396 99.20435 104.60871 99.01246
-1 98.04356 100.37825 101.49617 99.30919 101.19230 100.36205
0 98.58186 103.48134 95.66640 99.70614 96.91556 98.54077
1 99.18410 107.22746 93.26000 97.57466 92.34082 102.31979
2 100.23080 106.49245 92.92001 98.18450 94.20636 101.91376
3 99.52687 104.63686 94.18402 98.04239 99.72684 103.62157
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.