Description Usage Arguments Value Examples
Simulation of multivariate arma model of type 'marima'.
1 2 3 |
kvar |
dimension of one observation (from kvar-variate time series). |
ar.model |
array holding the autoregressive part of model, organised as in the marima$ar.estimates. May be empty (default = NULL) when there is no autoregressive part. |
ar.dif |
array holding differencing polynomium of model, typically generated by applying the function define.dif. May be empty (default = NULL) when differencing is not included. |
ma.model |
array holding the moving average part of model, organised as in the marima$ma.estimates. May be empty (default = NULL) when there is no moving average part. |
averages |
vector holding the kvar averages of the variables in the simulated series. |
resid.cov |
(kvar x kvar) innovation covariance matrix. |
seed |
seed for random number generator (set.seed(seed)). If the seed is set by the user, the random number generator is initialised. If seed is not set no initialisation is done. |
nstart |
number of extra observations in the start of the simulated series to be left out before returning. If nstart=0 in calling marima.sim a suitable value is computed (see code). |
nsim |
length of (final) simulated series. |
Simulated kvar variate time series of length = nsim.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | library(marima)
data(austr)
old.data <- t(austr)[, 1:83]
Model2 <- define.model(kvar=7, ar=c(1), ma=c(1),
rem.var=c(1, 6, 7), indep=NULL)
Marima2 <- marima(old.data, means=1, ar.pattern=Model2$ar.pattern,
ma.pattern=Model2$ma.pattern, Check=FALSE, Plot="none", penalty=4)
resid.cov <- Marima2$resid.cov
averages <- Marima2$averages
ar <- Marima2$ar.estimates
ma <- Marima2$ma.estimates
N <- 1000
kvar <- 7
y.sim <- marima.sim(kvar = kvar, ar.model = ar, ma.model = ma,
seed = 4711, averages = averages, resid.cov = resid.cov, nsim = N)
# Now simulate from model identified by marima (model=Marima2).
# The relevant ar and ma patterns are saved in
# Marima2$out.ar.pattern and Marima2$out.ma.pattern, respectively:
Marima.sim <- marima( t(y.sim), means=1,
ar.pattern=Marima2$out.ar.pattern,
ma.pattern=Marima2$out.ma.pattern,
Check=FALSE, Plot="none", penalty=0)
cat("Comparison of simulation model and estimates",
" from simulated data. \n")
round(Marima2$ar.estimates[, , 2], 4)
round(Marima.sim$ar.estimates[, , 2], 4)
round(Marima2$ma.estimates[, , 2], 4)
round(Marima.sim$ma.estimates[, , 2], 4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.