Function generates data using ETS with Single Source of Error as a data generating process for the demand occurrence. As the main output it produces probabilities of occurrence.
sim.oes(model = "MNN", obs = 10, nsim = 1, frequency = 1,
occurrence = c("odds-ratio", "inverse-odds-ratio", "direct", "general"),
bounds = c("usual", "admissible", "restricted"), randomizer = c("rlnorm",
"rinvgauss", "rgamma", "rnorm"), persistence = NULL, phi = 1,
initial = NULL, initialSeason = NULL, modelB = model,
persistenceB = persistence, phiB = phi, initialB = initial,
initialSeasonB = initialSeason, ...)
List of the following values is returned:
model
- Name of ETS model.
modelA
- Model A, generated using sim.es()
function;
modelB
- Model B, generated using sim.es()
function;
probability
- The value of probability generated by the model;
occurrence
- Type of occurrence used in the model;
logLik
- Log-likelihood of the constructed model.
Type of ETS model according to [Hyndman et. al., 2008]
taxonomy. Can consist of 3 or 4 chars: ANN
, AAN
, AAdN
,
AAA
, AAdA
, MAdM
etc. The conventional oETS model assumes
that the error term is positive, so "MZZ" models are recommended for this.
If you use additive error models, then the function will exponentiate the
obtained values before transforming them and getting the probability. This
is the type of model A.
Number of observations in each generated time series.
Number of series to generate (number of simulations to do).
Frequency of generated data. In cases of seasonal models must be greater than 1.
Type of occurrence model. See vignette("oes","smooth")
for details.
Type of bounds to use for persistence vector if values are
generated. "usual"
- bounds from p.156 by Hyndman et. al., 2008.
"restricted"
- similar to "usual"
but with upper bound equal
to 0.3. "admissible"
- bounds from tables 10.1 and 10.2 of Hyndman
et. al., 2008. Using first letter of the type of bounds also works. These
bounds are also used for multiplicative models, but the models are much
more restrictive, so weird results might be obtained. Be careful!
Type of random number generator function used for error
term. It is advised to use rlnorm()
or rinvgauss()
in case of
multiplicative error models. If a randomiser is used, it is advised to
specify the parameters in the ellipsis.
Persistence vector, which includes all the smoothing
parameters. Must correspond to the chosen model. The maximum length is 3:
level, trend and seasonal smoothing parameters. If NULL
, values are
generated.
Value of damping parameter. If trend is not chosen in the model, the parameter is ignored.
Vector of initial states of level and trend. The maximum
length is 2. If NULL
, values are generated.
Vector of initial states for seasonal coefficients.
Should have length equal to frequency
parameter. If NULL
,
values are generated.
Type of model B. This is used in occurrence="general"
and occurrence="inverse-odds-ratio"
.
The persistence vector for the model B.
Value of damping parameter for the model B.
Vector of initial states of level and trend for the model B.
Vector of initial states for seasonal coefficients for the model B.
Additional parameters passed to the chosen randomizer. All the parameters should be passed in the order they are used in chosen randomizer. Both model A and model B share the same parameters for the randomizer.
Ivan Svetunkov, ivan@svetunkov.com
For the information about the function, see the vignette:
vignette("simulate","smooth")
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. tools:::Rd_expr_doi("10.1007/978-3-540-71918-2").
oes, sim.es, Distributions
# This example uses rinvgauss function from statmod package.
oETSMNNIG <- sim.oes(model="MNN",frequency=12,obs=60,
randomizer="rinvgauss",mean=1,dispersion=0.5)
# A simpler example with log normal distribution
oETSMNNlogN <- sim.oes(model="MNN",frequency=12,obs=60,initial=1,
randomizer="rlnorm",meanlog=0,sdlog=0.1)
Run the code above in your browser using DataLab