gen_level_outlier_matrix: Generate level change regression matrix

View source: R/gen_level_outlier_matrix.r

gen_level_outlier_matrixR Documentation

Generate level change regression matrix

Description

Generates a regression matrix of LS (level change) outliers to be included in weekly modeling routines

Usage

gen_level_outlier_matrix(
  outlier_dates,
  this_week,
  this_year,
  forecast = 0,
  air_name = TRUE,
  x13type = TRUE,
  return_xts = FALSE
)

Arguments

outlier_dates

Integer matrix - matrix of dates for LS outliers

this_week

Numeric vector; Week of the year for each observation.

this_year

Numeric vector; Year of each observation.

forecast

Numeric scalar; Number of forecasts. Default: 0.

air_name

Logical scalar; If TRUE, names are formatted as they are in the fractional airline routine; otherwise format them as in movereg. Default: TRUE

x13type

Logical scalar; Indicates if level change outlier is defined as in X-13ARIMA-SEATS. Default: TRUE.

return_xts

Logical scalar; return matrix as an xts time series object. Default is FALSE. If TRUE, this_week and this_year should be xts time series objects.

Value

Generate matrix of level change outlier regressors, with column names that describe the individual regressors

Examples

ic_level_dates <-
   matrix(c(12, 2020, 13, 2020), ncol=2, byrow=TRUE)
ic_level_matrix <-
   gen_level_outlier_matrix(ic_level_dates, ic_week, ic_year, 0,
                            return_xts = FALSE)
cc_level_dates <-
   matrix(c(12, 2020, 13, 2020), ncol=2, byrow=TRUE)
cc_level_matrix_xts <-
   gen_level_outlier_matrix(cc_level_dates, cc_week_xts, cc_year_xts, 0,
                            return_xts = TRUE)

bcmonsell/airutilities documentation built on May 16, 2022, 3:23 p.m.