“events” object contains two columns: “name”
consists of names of the event, and “when” is the
respective event time. ‘class’ of ‘index’ of “z”
and “when” should be same and one of the ‘date-time’ or
‘Date’ classes.
If an event date does not lie within the index of “z”, the function
approximates to the nearest previous time using
findInterval
. Note that ‘findInterval’ assumes the
index of ‘z’ is non-decreasing.
The argument “width” provides the user with an option to define
successful events as those that have data within a window around the
event. Window is defined as (-width, +width]. If “width” is 10
periods, those events with ‘NA’ within 10 periods before and
after the event will be classified as “wdatamissing”,
otherwise, the event “outcome” will be classified as
“success”.
Currently this function requires “z” to have at least one
column. It relies on ‘colnames’ of “z” for the series
names, and matches it with the “events” object. One can use
drop = FALSE
with ‘[’ to achieve a single-column object.