gen_movereg_holiday_xts: Generate Movreg holiday regression matrix, using xts series...

View source: R/gen_movereg_holiday_xts.r

gen_movereg_holiday_xtsR Documentation

Generate Movreg holiday regression matrix, using xts series as input

Description

Generates a matrix with holiday regressors as defined within the BLS weekly adjustment program Movereg

Usage

gen_movereg_holiday_xts(
  hol_n,
  hol_index,
  hol_wt,
  hol_type,
  this_week,
  this_year,
  return_xts = FALSE
)

Arguments

hol_n

Numeric scalar; number of weights for this particular holiday

hol_index

Numeric scalar; position of holiday within the weight vector

hol_wt

Numeric vector; weight vector for holiday effect

hol_type

Character scalar; Type of holiday ('newyear' for New Years Day, 'mlk' for MLK Observance, 'president' for President's Day, 'easter' for Easter, 'memorial' for Memorial Day, 'july4' for Independence Day, 'labor' for Labor Day, 'columbus' for Columbus Day, 'veteran' for Veterans Day, 'thanks' for Thanksgiving).

this_week

Numeric vector; Week of the year for each observation, stored as an xts time series object.

this_year

Numeric vector; Year of each observation, stored as an xts time series object.

return_xts

Logical scalar; return matrix as an xts time series object. Default is FALSE.

Value

Generate matrix of holiday regressors as defined within the BLS weekly adjustment program Movereg

Examples

ic_easter_xts  <-
  gen_movereg_holiday_xts(hol_n = 8,
                          hol_index = 8,
                          hol_wt = c(1, 0, 0, 0, 0, 0, 0, 0),
                          hol_type = 'easter',
                          this_week = ic_week_xts,
                          this_year = ic_year_xts)
ic_labor_xts  <-
  gen_movereg_holiday_xts(hol_n = 2,
                          hol_index = 2,
                          hol_wt = c(0, 1),
                          hol_type = 'labor',
                          this_week = ic_week_xts,
                          this_year = ic_year_xts)
ic_thanksgiving_xts <-
  gen_movereg_holiday_xts(hol_n = 1,
                          hol_index = 1,
                          hol_wt = array(1, dim=1),
                          hol_type = 'thanksgiving',
                          this_week = ic_week_xts,
                          this_year = ic_year_xts)
ic_holiday_matrix_reduced_xts <- 
   cbind(ic_easter_xts, ic_labor_xts, ic_thanksgiving_xts)
colnames(ic_holiday_matrix_reduced_xts) <- c('easter', 'labor', 'thanksgiving')

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