This function simulates a monthly time series according to the simulation model of Bandara, Hyndman and Bergmeir (2021) about the MSTL-algorithm for seasonal-trend decomposition. The simulated time series consists of a trend, annual seasonal and irregular component which are each simulated independently from each other. After the simulation process they are normalized and then combined to form the complete time series. As in the paper, this simulation function has the option to distinguish between a deterministic and a stochastic data generation process.
sim_monthly_mstl(
N,
multiplicative = TRUE,
start = 2020,
sizeSeasonality = 100,
sizeIrregularity = 100,
sizeTrend = 100,
shockSeasonality = 1,
deterministic = FALSE
)
Multiple simulated monthly time series of class xts including:
The original series
The original series without seasonal effects
The seasonal effect
length in years
If TRUE, a multiplicative model is simulated, if FALSE, the model is additive
Start year or start date of the simulation.
Size of the annual seasonal factor.
Size of the irregular component.
Size of trend component.
Variance of the shock to the annual seasonal coefficient, defaulted to 1.
If TRUE, the seasonal coefficients are deterministic, meaning they do not change after a seasonal cycle. If FALSE, the coefficients are stochastic, meaning they change by random shocks after a seasonal cycle.
Nikolas Fritz, Daniel Ollech
Bandara, K., Hyndman, R. J., & Bergmeir, C. (2021). MSTL: A seasonal-trend decomposition algorithm for time series with multiple seasonal patterns. arXiv preprint arXiv:2107.13462.
x <- sim_monthly_mstl(4)
ts.plot(x[,1])
Run the code above in your browser using DataLab