Simulate a time series containing specified calendar effects
sim_calendar(
n,
which = c("Easter", "Ascension"),
from = 0,
to = 0,
freq = 12,
effect_size = 3,
start = "2020-01-01",
multiplicative = TRUE,
time_dynamic = 1,
center = TRUE
)
The function returns a time series of class xts
Time series length
Holidays to be used, functions from timeDate package used
days before the Holiday to include
days after the Holiday to include
Frequency of the time series
Mean size of calendar effect
Start Date of output time series
Boolean. Is multiplicative time series model assumed?
Should the calendar effect change over time
Should calendar variable be center, i.e. mean=0
Daniel Ollech
If multiplicative is true, the effect size is measured in percentage. If is not true, the effect size is unit less and thus adopts the unit of the time series the calendars are added to. The time_dynamic parameter controls the change of the calendar effect. The effect of the previous year is multiplied by the time_dynamic factor.
Ollech, D. (2021). Seasonal adjustment of daily time series. Journal of Time Series Econometrics. tools:::Rd_expr_doi("10.1515/jtse-2020-0028")
plot(sim_calendar(60, from=0, to=4, freq=12))
Run the code above in your browser using DataLab