| my_ao | R Documentation |
Constructs a matrix of additive outlier (AO) indicator variables based on a set of user-specified outlier dates. For each outlier date that coincides with an observation date, a binary indicator equal to one is created at the corresponding position and zero elsewhere. Outlier dates not present in the observation dates are silently ignored.
my_ao(dates, out.list)
dates |
A vector of class |
out.list |
A vector of class |
A numeric matrix with length(dates) rows and one column per
outlier date present in dates. Column names are of the form
"AO <date>". If none of the supplied outlier dates coincide with
dates, NULL is returned.
# create a sequence of dates
dates=seq.Date(from=as.Date("2023-01-02"),by="weeks",length.out = 100)
# create a vector of outlier dates
my_ao_dates=as.Date(c("2023-01-02","2023-01-03"))
# create a matrix of AO variables
my_ao(dates = dates,out.list = my_ao_dates)
# as you can see there is only one column corresponding to 2023-01-02,
# the second date is ignored because it is not present in the dates vector
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.