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 MSGARCH_SPEC created with CreateSpec or fit object of type MSGARCH_ML_FIT created with FitML or MSGARCH_MCMC_FIT created with FitMCMC.

nsim

Number of simulations. (Default: nsim = 1L)

seed

Integer indicating if and how the random number generator should be initialized. If seed = NULL, the state of the random generator will not change. (Default: seed = NULL)

nahead

Simulation length. (Default: nahead = 1L)

par

Vector (of size d) or matrix (of size nahead x d) of parameter

nburn

Burnin period discarded (first simulation draws).

...

Not used. Other arguments to simulate.

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:.

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)

[Package MSGARCH version 2.51 Index]