my_ao: Create additive outlier indicator variables

View source: R/my_ao.R

my_aoR Documentation

Create additive outlier indicator variables

Description

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.

Usage

my_ao(dates, out.list)

Arguments

dates

A vector of class "Date" corresponding to the observation dates.

out.list

A vector of class "Date" specifying candidate additive outlier dates.

Value

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.

Examples


# 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


boiwsa documentation built on Dec. 14, 2025, 5:06 p.m.