User defined trading day regressors are generated depending on a list of country-specific holidays and associated weights. Each holiday can be given a specific weight depending on the extent of the work load of that specific holiday.

genTd(
  freq = 12,
  firstYear = 1960,
  lastYear = 2099,
  hd,
  weight = rep(1, length(hd)),
  adjustEaster = "exact"
)

Arguments

freq

frequency of series

firstYear

first year of calculation of trading day regressor

lastYear

last year of calculation of trading day regressor

hd

holidays, list of 1. exact date ("mm-dd") and/or 2. name of day (listHolidays() from timeDate function) and/or 3. easter relation (e.g. "easter+39", "easter-3")

weight

vector of individual weights for each holiday with length of hd

adjustEaster

"exact" or "approximate" to employ theoretical distribution of easter dates (default) or approximate distribution of easter dates for centering of trading days

Value

list with three list elements. 1. matrix of trading day counts for each individual day, month and year. Holidays which are delivered through the parameter hd are assigned to the number of sundays. 2. multiple time series object with 6 non-centered trading day regressors plus 1 non-centered working day regressor (columns 1 to 6 refer to Mondays to Saturdays, colunm 7 refers to the one-regressor case of 5 working days). In case of trading day adjustment the first 6 columns have to be selected, in case of wording day adjustment only column 7 has to be selected. 3. multiple time series object with 6 centered trading day regressors plus 1 centered working day regressor

Examples

hdAT <- genTd(hd = list("01-01","01-06","05-01","easter+1", "easter+39",
                        "easter+50","easter+60",
                         "08-15","10-26","11-01","12-08","12-24","12-25",
                         "12-26","12-31"),
                        weight = c(rep(1,11),0.5,rep(1,2),0.5))
obj_x13 <- perX13(AirPassengers, template = "RSA3", tradingdays.option = "UserDefined",
                        usrdef.varType = "Calendar",
                        usrdef.varEnabled = TRUE, usrdef.var = hdAT[[3]])
#> Warning: With tradingdays.option = "UserDefined", the parameters tradingdays.autoadjust, tradingdays.leapyear and tradingdays.stocktd are ignored.
obj_x13$run()
obj_x13$output$regarima
#> y = regression model + arima (0, 1, 1, 0, 1, 1)
#> Log-transformation: yes
#> Coefficients:
#>           Estimate Std. Error
#> Theta(1)   -0.3312      0.086
#> BTheta(1)  -0.5592      0.077
#> 
#>             Estimate Std. Error
#> Monday     -0.023725      0.032
#> Tuesday     0.041099      0.025
#> Wednesday  -0.032134      0.028
#> Thursday    0.003771      0.017
#> Friday     -0.028879      0.021
#> Saturday    0.013849      0.017
#> lpYear     -0.054290      0.059
#> Easter [8]  0.011866      0.010
#> 
#> 
#> Residual standard error: 0.03475 on 120 degrees of freedom
#> Log likelihood = 251.9, aic = 988.8 aicc =   991, bic(corrected for length) = -6.347
#>