gen_movereg_holiday: Generate Movreg holiday regression matrix

View source: R/gen_movereg_holiday.r

gen_movereg_holidayR Documentation

Generate Movreg holiday regression matrix

Description

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

Usage

gen_movereg_holiday(hol_n, hol_index, hol_wt, hol_type, this_week, this_year)

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.

this_year

Numeric vector; Year of each observation.

Value

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

Examples

ic_easter  <-
  gen_movereg_holiday(hol_n = 8,
                      hol_index = 8,
                      hol_wt = c(1, 0, 0, 0, 0, 0, 0, 0),
                      hol_type = 'easter',
                      this_week = ic_week,
                      this_year = ic_year)
ic_labor  <-
  gen_movereg_holiday(hol_n = 2,
                      hol_index = 2,
                      hol_wt = c(0, 1),
                      hol_type = 'labor',
                      this_week = ic_week,
                      this_year = ic_year)
ic_thanksgiving <-
  gen_movereg_holiday(hol_n = 1,
                      hol_index = 1,
                      hol_wt = array(1, dim=1),
                      hol_type = 'thanksgiving',
                      this_week = ic_week,
                      this_year = ic_year)
ic_holiday_matrix_reduced <- cbind(ic_easter, ic_labor, ic_thanksgiving)
colnames(ic_holiday_matrix_reduced) <- c('easter', 'labor', 'thanksgiving')

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