calendar: Calendar effects

calendar.tfmR Documentation

Calendar effects

Description

calendar extends the ARIMA model um by including a set of deterministic variables to capture the calendar variation in a monthly time series. Two equivalent representations are available: (i) D0, D1, ..., D6, (ii) L, D1-D0, ..., D6-D0 where D0, D2, ..., D6 are deterministic variables representing the number of Sundays, Mondays, ..., Saturdays, L = D0 + D1 + ... + D6 is the of the month. Alternatively, the Leap Year indicator (LPY) can be included instead of L. The seven trading days can also be compacted into two variables: week days and weekends. Optionally, a deterministic variable to estimate the Easter effect can also be included, see "easter".

Usage

## S3 method for class 'tfm'
calendar(
  mdl,
  y = NULL,
  form = c("dif", "td", "td7", "td6", "wd"),
  ref = 0,
  lom = TRUE,
  lpyear = TRUE,
  easter = FALSE,
  len = 4,
  easter.mon = FALSE,
  n.ahead = 0,
  p.value = 1,
  envir = NULL,
  ...
)

calendar(mdl, ...)

## S3 method for class 'um'
calendar(
  mdl,
  y = NULL,
  form = c("dif", "td", "td7", "td6", "wd"),
  ref = 0,
  lom = TRUE,
  lpyear = TRUE,
  easter = FALSE,
  len = 4,
  easter.mon = FALSE,
  n.ahead = 0,
  p.value = 1,
  envir = NULL,
  ...
)

Arguments

mdl

an object of class um or tfm.

y

a time series.

form

representation for calendar effects: (1) form = dif, L, D1-D0, ..., D6-D0; (2) form = td, LPY, D1-D0, ..., D6-D0; (3) form = td7, D0, D2, ..., D6; (4) form = td6, D1, D2, ..., D6; (5) form = wd, (D1+...+D5) - 2(D6+D0)/5.

ref

a integer indicating the the reference day. By default, ref = 0.

lom, lpyear

a logical value indicating whether or not to include the lom/lead year indicator.

easter

logical. If TRUE an Easter effect is also estimated.

len

the length of the Easter, integer.

easter.mon

logical. TRUE indicates that Easter Monday is a public holiday.

n.ahead

a positive integer to extend the sample period of the deterministic variables with n.ahead observations, which could be necessary to forecast the output.

p.value

estimates with a p-value greater than p.value are omitted.

envir

environment in which the function arguments are evaluated. If NULL the calling environment of this function will be used.

...

other arguments.

Value

An object of class "tfm".

References

W. R. Bell & S. C. Hillmer (1983) Modeling Time Series with Calendar Variation, Journal of the American Statistical Association, 78:383, 526-534, DOI: 10.1080/01621459.1983.10478005

Examples

Y <- tfarima::rsales
um1 <- um(Y, i = list(1, c(1, 12)), ma = list(1, c(1, 12)), bc = TRUE)
tfm1 <- calendar(um1)


tfarima documentation built on May 20, 2022, 5:06 p.m.