sim_sfac {tssim} | R Documentation |
Simulate a seasonal factor
Description
Simulate a seasonal factor
Usage
sim_sfac(
n,
freq = 12,
sd = 1,
change_sd = sd/10,
moving = TRUE,
beta_1 = 0.6,
beta_tau = 0.4,
start = c(2020, 1),
multiplicative = TRUE,
ar = NULL,
ma = NULL,
model = c(1, 1, 1),
sc_model = list(order = c(1, 1, 1), ar = 0.65, ma = 0.25),
smooth = TRUE,
burnin = 7,
extra_smooth = FALSE
)
Arguments
n |
Number of observations |
freq |
Frequency of the time series |
sd |
Standard deviation of the seasonal factor |
change_sd |
Standard deviation of shock to seasonal factor |
moving |
Is the seasonal pattern allowed to change over time |
beta_1 |
Persistence wrt to previous period of the seasonal change |
beta_tau |
Persistence wrt to one year/cycle of the seasonal change |
start |
Start date of output time series |
multiplicative |
Boolean. Should multiplicative seasonal factors be simulated |
ar |
AR parameter |
ma |
MA parameter |
model |
Model for initial seasonal factor |
sc_model |
Model for the seasonal change |
smooth |
Boolean. Should initial seasonal factor be smoothed |
burnin |
(burnin*n-n) is the burn-in period |
extra_smooth |
Boolean. Should the seasonal factor be smoothed on a period-by-period basis |
Details
Standard deviation of the seasonal factor is in percent if a multiplicative time series model is assumed. Otherwise it is in unitless. Using a non-seasonal ARIMA model does not impact the seasonality of the time series. It can just make it easier for human eyes to grasp the seasonal nature of the series. The definition of the ar and ma parameter needs to be in line with the chosen model.
Value
The function returns a time series of class ts
containing a seasonal or periodic effect.
Author(s)
Daniel Ollech
References
Ollech, D. (2021). Seasonal adjustment of daily time series. Journal of Time Series Econometrics. doi:10.1515/jtse-2020-0028
Examples
ts.plot(sim_sfac(60))