svsim: Simulating a Stochastic Volatility Process

View source: R/simulation.R

svsimR Documentation

Simulating a Stochastic Volatility Process

Description

svsim is used to produce realizations of a stochastic volatility (SV) process.

Usage

svsim(len, mu = -10, phi = 0.98, sigma = 0.2, nu = Inf, rho = 0)

Arguments

len

length of the simulated time series.

mu

level of the latent log-volatility AR(1) process. The defaults value is -10.

phi

persistence of the latent log-volatility AR(1) process. The default value is 0.98.

sigma

volatility of the latent log-volatility AR(1) process. The default value is 0.2.

nu

degrees-of-freedom for the conditional innovations distribution. The default value is Inf, corresponding to standard normal conditional innovations.

rho

correlation between the observation and the increment of the log-volatility. The default value is 0, corresponding to the basic SV model with symmetric “log-returns”.

Details

This function draws an initial log-volatility h_0 from the stationary distribution of the AR(1) process defined by phi, sigma, and mu. Then the function jointly simulates the log-volatility series h_1,...,h_n with the given AR(1) structure, and the “log-return” series y_1,...,y_n with mean 0 and standard deviation exp(h/2). Additionally, for each index i, y_i can be set to have a conditionally heavy-tailed residual (through nu) and/or to be correlated with (h_{i+1}-h_i) (through rho, the so-called leverage effect, resulting in asymmetric “log-returns”).

Value

The output is a list object of class svsim containing

y

vector of length len containing the simulated data, usually interpreted as “log-returns”.

vol

vector of length len containing the simulated instantaneous volatilities. These are e^{h_t/2} if nu == Inf, and they are e^{h_t/2} \sqrt{\tau_t} for finite nu.

vol0

The initial volatility exp(h_0/2), drawn from the stationary distribution of the latent AR(1) process.

para

a named list with five elements mu, phi, sigma, nu, and rho, containing the corresponding arguments.

latent

vector of the latent state space h_t for t > 0.

latent0

initial element of the latent state space h_0.

tau

vector of length len containing the simulated auxiliary variables for the Student-t residuals when nu is finite. More precisely, \tau_t\sim\text{Gamma}^{-1}(\text{shape}=\nu/2, \text{rate}=\nu/2-1).

Note

The function generates the “log-returns” by y <- exp(-h/2)*rt(h, df=nu). That means that in the case of nu < Inf the (conditional) volatility is sqrt(nu/(nu-2))*exp(h/2), and that corrected value is shown in the print, summary and plot methods.

To display the output use print, summary and plot. The print method simply prints the content of the object in a moderately formatted manner. The summary method provides some summary statistics (in %), and the plot method plots the the simulated 'log-returns' y along with the corresponding volatilities vol.

Author(s)

Gregor Kastner gregor.kastner@wu.ac.at

See Also

svsample

Examples

## Simulate a highly persistent SV process of length 500
sim <- svsim(500, phi = 0.99, sigma = 0.1)

print(sim)
summary(sim)
plot(sim)

## Simulate an SV process with leverage
sim <- svsim(200, phi = 0.94, sigma = 0.15, rho = -0.6)

print(sim)
summary(sim)
plot(sim)

## Simulate an SV process with conditionally heavy-tails
sim <- svsim(250, phi = 0.91, sigma = 0.05, nu = 5)

print(sim)
summary(sim)
plot(sim)


stochvol documentation built on Nov. 27, 2023, 1:09 a.m.