CalendarVar: Calendar variables

View source: R/detvar.R

CalendarVarR Documentation

Calendar variables

Description

'CalendarVar()' creates a set of deterministic regressors to capture calendar effects (trading/working days, length-of-month, leap-year and Easter).

Usage

CalendarVar(
  x,
  form = c("dif", "td", "td7", "td6", "wd", "null"),
  ref = 0,
  lom = TRUE,
  lpyear = TRUE,
  easter = FALSE,
  len = 4,
  easter.mon = FALSE,
  n.ahead = 0
)

Arguments

x

A 'ts' object used to determine start, length and frequency.

form

Character selecting the set of calendar variables: '"dif"' (differences wrt reference day), '"td"' (6 dummies + lom; omits reference), '"td7"' (7 dummies), '"td6"' (6 dummies; omits reference), '"wd"' (weekdays vs weekend), or '"null"' (no trading-day regressors).

ref

Non-negative integer (0–6) indicating the reference day (0 = Sunday, 1 = Monday, …, 6 = Saturday). Ignored unless 'form' needs it.

lom

Logical. If 'TRUE' include a length-of-month regressor.

lpyear

Logical. If 'TRUE' include a leap-year regressor.

easter

Logical. If 'TRUE' include an Easter regressor.

len

Integer duration for Easter effect (days). Typical values: 4–8.

easter.mon

Logical. 'TRUE' if Holy Monday is a public holiday.

n.ahead

Integer. Extra observations to extend the sample (forecast horizon).

Value

An object of class 'ts' or 'mts' with the requested regressors.

References

Bell, W.R. and Hillmer, S.C. (1983) “Modeling time series with calendar variation”, *Journal of the American Statistical Association*, 78, 526–534.

Examples

X <- CalendarVar(AirPassengers, form = "wd", easter = TRUE, len = 5)


tfarima documentation built on Nov. 5, 2025, 7:43 p.m.