sim.sma {smooth}R Documentation

Simulate Simple Moving Average

Description

Function generates data using SMA in a Single Source of Error state space model as a data generating process.

Usage

sim.sma(order = NULL, obs = 10, nsim = 1, frequency = 1,
  initial = NULL, randomizer = c("rnorm", "rt", "rlaplace", "rs"),
  probability = 1, ...)

Arguments

order

Order of the modelled series. If omitted, then a random order from 1 to 100 is selected.

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.

initial

Vector of initial states for the model. If NULL, values are generated.

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:

Author(s)

Ivan Svetunkov, ivan@svetunkov.ru

References

See Also

es, ts, Distributions

Examples


# Create 40 observations of quarterly data using AAA model with errors from normal distribution
sma10 <- sim.sma(order=10,frequency=4,obs=40,randomizer="rnorm",mean=0,sd=100)


[Package smooth version 4.0.2 Index]