simulate.MSGARCH_SPEC {MSGARCH} | R Documentation |
Simulation of MSGARCH processes.
Description
Method for simulating MSGARCH
processes.
Usage
## S3 method for class 'MSGARCH_SPEC'
simulate(
object,
nsim = 1L,
seed = NULL,
nahead = 1L,
par = NULL,
nburn = 500L,
...
)
## S3 method for class 'MSGARCH_ML_FIT'
simulate(object, nsim = 1L, seed = NULL, nahead = 1L, nburn = 500L, ...)
## S3 method for class 'MSGARCH_MCMC_FIT'
simulate(object, nsim = 1L, seed = NULL, nahead = 1L, nburn = 500L, ...)
Arguments
object |
Model specification of class |
nsim |
Number of simulations. (Default: |
seed |
Integer indicating if and how the random number generator should be initialized.
If |
nahead |
Simulation length. (Default: |
par |
Vector (of size d) or matrix (of size |
nburn |
Burnin period discarded (first simulation draws). |
... |
Not used. Other arguments to |
Details
If a matrix of parameters estimates is provided, nsim
simuations will be done for each row.
Value
A list of class MSGARCH_SIM
with the following elements:.
-
draw
: Matrix (of sizenahead
xnsim
) of simulated draws. -
state
: Matrix (of sizenahead
xnsim
) of simulated states. -
CondVol
: Array (of sizenahead
xnsim
x K) of simulated conditional volatilities.
The MSGARCH_SIM
class contains the plot
method.
Examples
# create specification
spec <- CreateSpec()
# simulation from specification
par <- c(0.1, 0.1, 0.8, 0.2, 0.1, 0.8, 0.99, 0.01)
set.seed(1234)
sim <- simulate(object = spec, nsim = 1L, nahead = 1000L,
nburn = 500L, par = par)
head(sim)
plot(sim)
# load data
data("SMI", package = "MSGARCH")
# simulation from ML fit
fit <- FitML(spec = spec, data = SMI)
set.seed(1234)
sim <- simulate(object = fit, nsim = 1L, nahead = 1000L,
nburn = 500L)
head(sim)
plot(sim)
## Not run:
# simulation from MCMC fit
fit <- FitMCMC(spec = spec, data = SMI)
set.seed(1234)
sim <- simulate(object = fit, nahead = 100L, nburn = 500L)
head(sim)
plot(sim)
## End(Not run)