| varmapack_model | R Documentation |
Create a model object for simulation of a Gaussian VAR, VMA, VARMA, or
VARMAX time series. The object stores model parameters and provides a
$sim() method for generating one or more independent series.
varmapack_model(A = NULL, B = NULL, C = NULL, Sig, mu = NULL)
A |
Autoregressive coefficient matrices as an |
B |
Moving-average coefficient matrices as an |
C |
Exogenous coefficient matrices as an |
Sig |
|
mu |
Optional |
A VarmapackModel object.
model$sim(length, nrep = 1L, X0 = NULL, z = NULL, rng = NULL, return_shocks = FALSE) simulates nrep independent series of the supplied
length.
For VARMA models, X0 is optional. If provided, it is an r by nX0
matrix or an r by nX0 by nrep array. Its second dimension must be at
least max(p, q), and its third dimension, when present, must be 1 or
nrep.
Nonstationary VARMA models require X0; with MA terms, Sig must be
positive definite and startup shocks are conditioned on the residual
equations implied by the supplied history.
For VARMAX models, z is required. X0 has the same form and its second
dimension must be at least max(p, q, s - 1). It may be omitted when this
minimum is zero. The exogenous input z is a d by length matrix or a d
by length by nrep array. Its third dimension, when present, must be 1 or
nrep.
Pass a randompack::randompack_rng() object through rng to control the
random stream. When it is omitted, Varmapack uses a temporary randomized
default Randompack generator. With return_shocks = FALSE, the result is an
r by length by nrep array. With return_shocks = TRUE, it is a list
with components X and E, each with that shape.
model$acvf(maxlag) returns theoretical VARMA autocovariances,
model$psi(maxlag) returns impulse-response matrices, and
model$irf(maxlag) returns orthogonalized impulse-response matrices.
model$specrad() and model$ma_specrad() return the AR and MA spectral
radii, respectively. Theoretical autocovariances are not available for
VARMAX models with exogenous terms.
A <- matrix(c(0.4, 0.1, -0.2, 0.3), 2, 2)
model <- varmapack_model(A = A, Sig = diag(2))
X <- model$sim(100)
rng <- randompack::randompack_rng()
rng$seed(123)
X <- model$sim(100, nrep = 3, rng = rng)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.