remap.cumsum: Cumulative values

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/remap.cumsum.R

Description

This function remaps a time series into its cumulative summation.

Usage

1
remap.cumsum(z, is.pc = FALSE, base = 0)

Arguments

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

base

an integer specifying the base for cumulative sum.

Details

This function remaps a time series into ints cumulative summation. Function assigns first value as zero in the event window (-width) before cumulating the values.

Value

A zoo object with the cumulative summation for each series.

Author(s)

Chirag Anand, Vikram Bahure, Vimal Balasubramaniam

See Also

phys2eventtime

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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.cumsum(es.w, is.pc = FALSE, base = 0)

print(eventtime[as.character(-3:3), ])

Example output

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 -1.6351601 -0.06335868  1.505412 -2.5065523  1.9962578  1.3701605
-2 -3.3660264 -0.86379163  1.193368 -0.7352571  4.5509538 -0.9581156
-1 -1.9407766  0.38927385  1.492011 -0.6295744  1.2850683  0.4049408
0  -1.3917331  3.48067729 -4.251821 -0.2298726 -2.9412895 -1.4097690
1  -0.7808335  7.10076751 -6.767225 -2.3676291 -7.6616204  2.4252116
2   0.2744821  6.41529980 -7.131790 -1.7426271 -5.6413497  2.0283856
3  -0.4278228  4.67283446 -5.771472 -1.8873691  0.2186372  3.7041272

eventstudies documentation built on July 1, 2020, 10:26 p.m.