sim.ssarima: Simulate SSARIMA

View source: R/simssarima.R

sim.ssarimaR Documentation

Simulate SSARIMA

Description

Function generates data using SSARIMA with Single Source of Error as a data generating process.

Usage

sim.ssarima(orders = list(ar = 0, i = 1, ma = 1), lags = 1, obs = 10,
  nsim = 1, frequency = 1, AR = NULL, MA = NULL, constant = FALSE,
  initial = NULL, bounds = c("admissible", "none"),
  randomizer = c("rnorm", "rt", "rlaplace", "rs"), probability = 1, ...)

Arguments

orders

List of orders, containing vector variables ar, i and ma. Example: orders=list(ar=c(1,2),i=c(1),ma=c(1,1,1)). If a variable is not provided in the list, then it is assumed to be equal to zero. At least one variable should have the same length as lags.

lags

Defines lags for the corresponding orders (see examples above). The length of lags must correspond to the length of orders. There is no restrictions on the length of lags vector. It is recommended to order lags ascending.

obs

Number of observations in each generated time series.

nsim

Number of series to generate (number of simulations to do).

frequency

Frequency of generated data. In cases of seasonal models must be greater than 1.

AR

Vector or matrix of AR parameters. The order of parameters should be lag-wise. This means that first all the AR parameters of the firs lag should be passed, then for the second etc. AR of another ssarima can be passed here.

MA

Vector or matrix of MA parameters. The order of parameters should be lag-wise. This means that first all the MA parameters of the firs lag should be passed, then for the second etc. MA of another ssarima can be passed here.

constant

If TRUE, constant term is included in the model. Can also be a number (constant value).

initial

Vector of initial values for state matrix. If NULL, then generated using advanced, sophisticated technique - uniform distribution.

bounds

Type of bounds to use for AR and MA if values are generated. "admissible" - bounds guaranteeing stability and stationarity of SSARIMA. "none" - we generate something, but do not guarantee stationarity and stability. Using first letter of the type of bounds also works.

randomizer

Type of random number generator function used for error term. Defaults are: rnorm, rt, rlaplace and rs. rlnorm should be used for multiplicative models (e.g. ETS(M,N,N)). But any function from Distributions will do the trick if the appropriate parameters are passed. For example rpois with lambda=2 can be used as well, but might result in weird values.

probability

Probability of occurrence, used for intermittent data generation. This can be a vector, implying that probability varies in time (in TSB or Croston style).

...

Additional parameters passed to the chosen randomizer. All the parameters should be passed in the order they are used in chosen randomizer. For example, passing just sd=0.5 to rnorm function will lead to the call rnorm(obs, mean=0.5, sd=1).

Details

For the information about the function, see the vignette: vignette("simulate","smooth")

Value

List of the following values is returned:

  • model - Name of SSARIMA model.

  • AR - Value of AR parameters. If nsim>1, then this is a matrix.

  • MA - Value of MA parameters. If nsim>1, then this is a matrix.

  • constant - Value of constant term. If nsim>1, then this is a vector.

  • initial - Initial values of SSARIMA. If nsim>1, then this is a matrix.

  • data - Time series vector (or matrix if nsim>1) of the generated series.

  • states - Matrix (or array if nsim>1) of states. States are in columns, time is in rows.

  • residuals - Error terms used in the simulation. Either vector or matrix, depending on nsim.

  • occurrence - Values of occurrence variable. Once again, can be either a vector or a matrix...

  • logLik - Log-likelihood of the constructed model.

Author(s)

Ivan Svetunkov, ivan@svetunkov.ru

References

  • Snyder, R. D., 1985. Recursive Estimation of Dynamic Linear Models. Journal of the Royal Statistical Society, Series B (Methodological) 47 (2), 272-276.

  • Hyndman, R.J., Koehler, A.B., Ord, J.K., and Snyder, R.D. (2008) Forecasting with exponential smoothing: the state space approach, Springer-Verlag. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-3-540-71918-2")}.

  • Svetunkov, I., & Boylan, J. E. (2019). State-space ARIMA for supply-chain forecasting. International Journal of Production Research, 0(0), 1–10. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00207543.2019.1600764")}

See Also

sim.es, ssarima, Distributions, orders

Examples


# Create 120 observations from ARIMA(1,1,1) with drift. Generate 100 time series of this kind.
x <- sim.ssarima(ar.orders=1,i.orders=1,ma.orders=1,obs=120,nsim=100,constant=TRUE)

# Generate similar thing for seasonal series of SARIMA(1,1,1)(0,0,2)_4
x <- sim.ssarima(ar.orders=c(1,0),i.orders=c(1,0),ma.orders=c(1,2),lags=c(1,4),
                 frequency=4,obs=80,nsim=100,constant=FALSE)

# Generate 10 series of high frequency data from SARIMA(1,0,2)_1(0,1,1)_7(1,0,1)_30
x <- sim.ssarima(ar.orders=c(1,0,1),i.orders=c(0,1,0),ma.orders=c(2,1,1),lags=c(1,7,30),
                 obs=360,nsim=10)



smooth documentation built on Oct. 1, 2024, 5:07 p.m.