dynamicsSVM {SVDNF}R Documentation

Stochastic Volatility Models Dynamics

Description

dynamicsSVM creates stochastic volatility model dynamics by either choosing from a set of built-in model dynamics or using custom drift and diffusion functions, as well as custom jump distributions. See Note for information about how to define custom functions.

Usage

dynamicsSVM(mu = 0.038, kappa = 3.689, theta = 0.032, sigma = 0.446,
rho = -0.745, omega = 5.125, delta = 0.03, alpha = -0.014,
rho_z = -1.809, nu = 0.004, p = 0.01, phi = 0.965, h = 1/252,
model = "Heston", mu_x, mu_y, sigma_x, sigma_y,
jump_dist = rpois, jump_density = dpois, jump_params = 0,
mu_x_params, mu_y_params, sigma_x_params, sigma_y_params)

Arguments

mu

Annual expected rate of return.

kappa

Variance rate of mean reversion.

theta

Unconditional mean variance.

sigma

Volatility of the variance.

rho

Correlation between the return and the variance noise terms.

omega

Jump arrival intensity for models with Poisson jumps.

delta

Standard deviation of return jumps.

alpha

Mean of return jumps.

rho_z

Pseudo-correlation parameter between return and variance jumps.

nu

Mean for variance jumps.

p

Jump probability for models with Bernoulli jumps.

phi

Volatility persistence parameter.

h

Time interval between observations (e.g., h = 1/252 for daily data).

model

Model used by the discrete nonlinear filter. The options are "Heston", "Bates", "DuffiePanSingleton", "Taylor", "TaylorWithLeverage",
"PittMalikDoucet", and "Custom". If model = "Custom", users should pass the drift functions (i.e., mu_x and mu_y), the diffusion functions (i.e., sigma_x and sigma_y), and the jump distribution, (i.e., jump_dist) as well as their parameters to the DNF function. See Examples.

mu_x

Function for variance drift (to be used with a custom model).

mu_y

Function for returns drift (to be used with a custom model).

sigma_x

Function for variance diffusion (to be used with a custom model).

sigma_y

Function for returns diffusion (to be used with a custom model).

jump_dist

Distribution used to generate return or volatility jumps at each timestep (if both types of jumps are in the model, they are assumed to occur simulaneously).

jump_density

Probability mass function used to compute the probability of return or volatility jumps at each timestep (if both types of jumps are in the model, they are assumed to occur simulaneously).

jump_params

List of parameters to be used as arguments in the jump_dist and jump_density function (parameters should be listed in the order that jump_dist uses them).

mu_x_params

List of parameters to be used as arguments in the mu_x function (parameters should be listed in the order that mu_x uses them).

mu_y_params

List of parameters to be used as arguments in the mu_y function (parameters should be listed in the order that mu_y uses them).

sigma_x_params

List of parameters to be used as arguments in the sigma_x function (parameters should be listed in the order that sigma_x uses them).

sigma_y_params

List of parameters to be used as arguments in the sigma_y function (parameters should be listed in the order that sigma_y uses them).

Value

Returns an object of type dynamicsSVM.

Note

Custom functions should have x (the volatility factor) as well as the function's other parameters as arguments.

If the custom function does not use any parameters, one should include an argument called dummy and its parameters as a list(0). For example, for the Taylor model,

sigma_y_taylor <- function(x, dummy) { return(exp(x / 2)) }
sigma_y_params <- list(0)

It should also be noted that the custom function is a vector for x. This means that users should use vectorized version of functions. For example, pmax(0,x) instead of max(0,x) as code seen in the Example section below.

Examples

# Create a dynamicsSVM object with model DuffiePanSingleton and default parameters
DuffiePanSingleton_mod <- dynamicsSVM(model = "DuffiePanSingleton") 

# Here, we define the same DuffiePanSingleton model 
# using the custom model option.

# Daily observations
h <- 1/252

# Parameter values 
mu <- 0.038; kappa <- 3.689; theta <- 0.032
sigma <- 0.446; rho <- -0.745; omega <- 5.125
delta <- 0.03; alpha <- -0.014; rho_z <- -1.809; nu <- 0.004

# Jump compensator
alpha_bar <- exp(alpha + 0.5 * delta^2) / (1 - rho_z * nu) - 1

# Returns drift and diffusion
mu_y <- function(x, mu, alpha_bar, omega, h) {
  return(h * (mu - x / 2 - alpha_bar * omega))
}
mu_y_params <- list(mu, alpha_bar, omega, h)
sigma_y <- function(x, h) {
  return(sqrt(h * pmax(x, 0)))
}
sigma_y_params <- list(h)

# Volatility factor drift and diffusion
mu_x <- function(x, kappa, theta, h) {
  return(x + h * kappa * (theta - pmax(0, x)))
}
mu_x_params <- list(kappa, theta, h)

sigma_x <- function(x, sigma, h) {
  return(sigma * sqrt(h * pmax(x, 0)))
}
sigma_x_params <- list(sigma, h)

# Jump distribution for the DuffiePanSingleton Model
jump_density <- dpois
jump_dist <- rpois
jump_params <- c(h * omega)

# Create the custom model
custom_DPS <- dynamicsSVM(model = 'Custom',
  mu_x = mu_x, mu_y = mu_y, sigma_x = sigma_x, sigma_y = sigma_y,
  mu_x_params = mu_x_params, mu_y_params = mu_y_params,
  sigma_x_params = sigma_x_params, sigma_y_params = sigma_y_params,
  jump_params = jump_params, jump_dist = jump_dist, jump_density = jump_density,
  nu = nu, rho_z = rho_z)

[Package SVDNF version 0.1.8 Index]