sim_svp: Simulate from a Stochastic Volatility Model

View source: R/simu.R

sim_svpR Documentation

Simulate from a Stochastic Volatility Model

Description

Master simulation function for SV(p) models. Supports Gaussian, Student-t, and GED error distributions, with optional leverage effects. This mirrors the interface of svp for estimation.

Usage

sim_svp(
  n,
  phi,
  sigy,
  sigv,
  errorType = "Gaussian",
  leverage = FALSE,
  rho = 0,
  nu = NULL,
  burnin = 500
)

Arguments

n

Integer. Length of the simulated series.

phi

Numeric vector. AR coefficients for log-volatility (length p).

sigy

Numeric. Unconditional standard deviation of returns.

sigv

Numeric. Standard deviation of volatility innovations.

errorType

Character. Error distribution: "Gaussian" (default), "Student-t", or "GED".

leverage

Logical. If TRUE, simulate with leverage effects (correlated return and volatility shocks). Default is FALSE.

rho

Numeric. Leverage parameter (correlation between return and volatility shocks). Must be in [-1, 1]. Only used when leverage = TRUE. Default is 0.

nu

Numeric. Shape parameter for heavy-tailed distributions. Degrees of freedom for Student-t (must be > 2) or GED shape (must be > 0). Required when errorType is "Student-t" or "GED".

burnin

Integer. Number of initial observations to discard. Default 500.

Details

The model is:

y_t = \sigma_y \exp(w_t / 2) z_t

w_t = \phi_1 w_{t-1} + \cdots + \phi_p w_{t-p} + \sigma_v v_t

where z_t follows a distribution specified by errorType (Gaussian, Student-t, or GED), and v_t is i.i.d. standard normal. When leverage = TRUE, the correlation between z_t and v_{t+1} is \rho.

For Student-t errors with leverage, the scale-mixture representation z_t = \zeta_t \lambda_t^{-1/2} is used, where leverage operates through the Gaussian component \zeta_t. For GED errors with leverage, a Gaussian copula construction z_t = F_{\mathrm{GED}}^{-1}(\Phi(\zeta_t)) is used. In both cases the returned z is the effective return innovation (not the latent \zeta_t), with marginal distribution matching the errorType.

Value

A named list of four length-n numeric vectors:

y

Observed returns y_t.

h

Log-volatility process w_t (equivalently h_t).

z

Return innovation such that y_t = \sigma_y \exp(h_t/2)\, z_t. Marginal distribution matches errorType: N(0,1) for Gaussian, t(\nu) for Student-t, unit-variance GED(\nu) for GED.

v

Volatility innovation such that h_t - \sum_{j=1}^p \phi_j h_{t-j} = \sigma_v\, v_t. Always N(0,1); under leverage, v_t = \rho\, \zeta_{t-1} + \sqrt{1-\rho^2}\, \epsilon_t.

See Also

svp for estimation.

Examples


# Gaussian SV(1), no leverage
sim <- sim_svp(1000, phi = 0.95, sigy = 1, sigv = 0.2)
plot(sim$y, type = "l")

# Gaussian SV(1) with leverage
sim_lev <- sim_svp(1000, phi = 0.95, sigy = 1, sigv = 0.2,
                   leverage = TRUE, rho = -0.5)
plot(sim_lev$y, type = "l")

# Student-t SV(1)
sim_t <- sim_svp(1000, phi = 0.95, sigy = 1, sigv = 0.2,
                 errorType = "Student-t", nu = 5)
plot(sim_t$y, type = "l")

# GED SV(1)
sim_ged <- sim_svp(1000, phi = 0.95, sigy = 1, sigv = 0.2,
                   errorType = "GED", nu = 1.5)
plot(sim_ged$y, type = "l")



wARMASVp documentation built on May 15, 2026, 5:07 p.m.