simulate: Simulation of MSGARCH processes.

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

  • draw: Matrix (of size nahead x nsim) of simulated draws.

  • state: Matrix (of size nahead x nsim) of simulated states.

  • CondVol: Array (of size nahead x nsim 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)

MSGARCH documentation built on Dec. 6, 2022, 1:06 a.m.