simple_td: Generate a simple working-day trading-day regressor

View source: R/simple_td.R

simple_tdR Documentation

Generate a simple working-day trading-day regressor

Description

Constructs a weekly trading-day regressor by counting the number of full working days within each weekly period and centering the resulting series by subtracting its sample mean. Daily working-day information is supplied via df.td and mapped to the weekly dates provided in dates.

Usage

simple_td(dates, df.td)

Arguments

dates

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

df.td

A data frame containing daily working-day information with two columns: date (class "Date") and WORKING_DAY_PART. Full working days should be coded as 1; all other values are treated as non-working days.

Value

A data frame with two columns:

date

Weekly dates corresponding to dates.

td

Centered weekly count of full working days.

The returned object can be merged into a matrix of holiday/trading-day regressors supplied to boiwsa() via the H argument.

Examples


library(dplyr)
data(dates_il)
data(gasoline.data)

dates_il%>%
  dplyr::select(DATE_VALUE,ISR_WORKING_DAY_PART)%>%
  `colnames<-`(c("date","WORKING_DAY_PART"))%>%
  dplyr::mutate(date=as.Date(date))->df.td

td=simple_td(dates = gasoline.data$date,df.td = df.td)





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