Learn R Programming

garchx (version 1.6)

garchxSim: Simulate from a GARCH-X model

Description

Simulate from a GARCH(q,p,r)-X model. Optionally, if verbose=TRUE, the conditional variance and innovations are also returned.

Usage

garchxSim(n, intercept = 0.2, arch = 0.1, garch = 0.8, asym = NULL, xreg = NULL,
  innovations = NULL, backcast.values = list(), verbose = FALSE, as.zoo = TRUE,
  c.code = TRUE)

Value

a numeric vector or matrix with the simulated values.

Arguments

n

integer

intercept

numeric

arch

NULL or numeric vector with the values of the ARCH-coefficients

garch

NULL or numeric vector with the values of the GARCH-coefficients

asym

NULL or numeric vector with the values of the asymmetry-coefficients

xreg

NULL or numeric vector with the values of the X-term

innovations

NULL or numeric vector with the innovations. If NULL, then standard normal innovations are generated with rnorm

backcast.values

list with backcast values

verbose

logical

as.zoo

logical. If TRUE (default), then the returned object is of class zoo

c.code

logical. If TRUE (default), then compiled C code is used for the recursion (faster). Otherwise R code is used (slower)

Author

Genaro Sucarrat, https://www.sucarrat.net/

See Also

garchx, zoo

Examples

Run this code
##simulate from a garch(1,1):
y <- garchxSim(1000)

##simulate from a garch(1,1) with asymmetry/leverage:
yy <- garchxSim(1000, asym=0.1)

##simulate from a garch(1,1) w/user-provided backcast values:
yyy <- garchxSim(1000, backcast.values=list(z2=1, sigma2=0.5))

Run the code above in your browser using DataLab