Learn R Programming

tssim (version 0.2.7)

sim_monthly: Simulate a monthly seasonal series

Description

Simulate a monthly seasonal series

Usage

sim_monthly(
  N,
  sd = 5,
  change_sd = sd/10,
  beta_1 = 0.6,
  beta_tau = 0.4,
  moving = TRUE,
  model = list(order = c(3, 1, 1), ma = 0.5, ar = c(0.2, -0.4, 0.1)),
  start = c(2010, 1),
  multiplicative = TRUE,
  extra_smooth = FALSE
)

Value

Multiple simulated monthly time series of class xts including:

original

The original series

seas_adj

The original series without seasonal effects

sfac

The seasonal effect

Arguments

N

Length in years

sd

Standard deviation for all seasonal factors

change_sd

Standard deviation of shock to seasonal factor

beta_1

Persistance wrt to previous period of the seasonal change

beta_tau

Persistence wrt to one year/cycle of the seasonal change

moving

Is the seasonal pattern allowed to change over time

model

Model for non-seasonal time series. A list.

start

Start date of output time series

multiplicative

Boolean. Should multiplicative seasonal factors be simulated

extra_smooth

Boolean. Should the seasonal factors be smooth on a period-by-period basis

Author

Daniel Ollech

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 for the initialization of the seasonal factor 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 inline with the chosen model.

References

Ollech, D. (2021). Seasonal adjustment of daily time series. Journal of Time Series Econometrics. tools:::Rd_expr_doi("10.1515/jtse-2020-0028")

Examples

Run this code
x=sim_monthly(5, multiplicative=TRUE)
ts.plot(x[,1])

Run the code above in your browser using DataLab