prepareSimSarima {sarima} | R Documentation |
Prepare SARIMA simulations
Description
Prepare SARIMA simulations.
Usage
prepareSimSarima(model, x = NULL, eps = NULL, n, n.start = NA,
xintercept = NULL, rand.gen = rnorm)
## S3 method for class 'simSarimaFun'
print(x, ...)
Arguments
model |
an object from a suitable class or a list, see Details. |
x |
initial/before values of the time series, a list, a numeric vector or time series, see Details. |
eps |
initial/before values of the innovations, a list or a numeric vector, see Details. |
n |
number of observations to generate, if missing an attempt is made to
infer it from |
n.start |
number of burn-in observations. |
xintercept |
non-constant intercept which may represent trend or covariate effects. |
rand.gen |
random number generator, defaults to N(0,1). |
... |
ignored. |
Details
prepareSimSarima
does the preparatory work for simulation from
a Sarima model, given the specifications and returns a function, which
can be called as many times as needed.
The variance of the innovations is specified by the model and the simulated innovations are multiplied by the corresponding standard deviation. So, it is expected that the random number generator simulates from a standardised distribution.
Argument model
can be from any class representing models in the
SARIMA family, such as "SarimaModel", or a list with components
suitable to be passed to =new()= for such models.
The canonical form of argument x
is a list with components
before
, init
and main
. If any of these components
is missing or NULL, it is filled suitably. Any other components of
x
are ignored. If x
is not a list, it is put in
component main
. Conceptually, the three components are
concatenated in the given order, the simulated values are put in
main
(before
and init
are not changed), the
before
part is dropped and the rest is returned. In effect,
before
and init
can be viewed as initial values but
init
is considered part of the generated series.
The format for eps
is the same as that of x
. The lengths of
missing components in x
are inferred from the corresponding
components of eps
, and vice versa.
The format for xintercept
is the same as that of x
and
eps
.
print.simSarimaFun
is a print method for the objects generated
by prepareSimSarima
.
Value
for prepareSimSarima
, a function to simulate time series, see
Details. it is typically called multiple times without arguments.
All arguments have defaults set by prepareSimSarima
.
n |
length of the simulated time series, |
rand.gen |
random number generator, |
... |
arguments for the random number generator, passed on to
|
Author(s)
Georgi N. Boshnakov
See Also
Examples
mo1 <- list(ar = 0.9, iorder = 1, siorder = 1, nseasons = 4, sigma2 = 2)
fs1 <- prepareSimSarima(mo1, x = list(before = rep(0,6)), n = 100)
tmp1 <- fs1()
tmp1
plot(ts(tmp1))
fs2 <- prepareSimSarima(mo1, x = list(before = rep(1,6)), n = 100)
tmp2 <- fs2()
plot(ts(tmp2))
mo3 <- mo1
mo3[["ar"]] <- 0.5
fs3 <- prepareSimSarima(mo3, x = list(before = rep(0,6)), n = 100)
tmp3 <- fs3()
plot(ts(tmp3))