| sim_svp | R Documentation |
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.
sim_svp(
n,
phi,
sigy,
sigv,
errorType = "Gaussian",
leverage = FALSE,
rho = 0,
nu = NULL,
burnin = 500
)
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: |
leverage |
Logical. If |
rho |
Numeric. Leverage parameter (correlation between return and
volatility shocks). Must be in |
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 |
burnin |
Integer. Number of initial observations to discard. Default 500. |
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.
A named list of four length-n numeric vectors:
yObserved returns y_t.
hLog-volatility process w_t (equivalently h_t).
zReturn 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.
vVolatility 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.
svp for estimation.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.