Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: times
See also: simGBM simgOU

Quantlet: simHeston
Description: Simulation of the spot price and volatility processes in the Heston stochastic volatility model: dS(t) = mu S(t) dt + v^0.5 S(t) dW1(t) dv(t) = kappa (theta - v(t)) dt + sigma (v(t)^0.5) dW2(t) Cov[dW1(t), dW2(t)] = rho dt

Usage: x = simHeston(n,s0,v0,mu,kappa,theta,sigma,rho,delta)
Input:
n scalar, time. The number of observations is represented by (ceil(n/delta)+1).
s0 scalar, starting value of the spot price process
v0 scalar, starting value of the volatility process
mu scalar, drift of the spot price process
kappa scalar, speed of mean reversion of the volatility process
theta scalar, long-term mean of the volatility process
sigma scalar, volatility of the volatility process
rho scalar, correlation between the spot price and volatility processes
delta scalar, time step size. The process is simulated at time points 0, delta, 2*delta, ..., n*delta
Output:
x (n+1) x 2 matrix, simulated trajectories of the spot price S(t) and volatility v(t)

Example:
library("multi")
library("times")
library("plot")
randomize(123)
days = 250
time =(0:days)/days
L = 0.1		; long-term mean
x = 100*simHeston(1,0.1,3,L,0.29,3,0.9,0.5,1/days)   ; interest rate in %
s1 = setmask(time~x[,1],"line","black","thin","solid")
s2 = setmask(time~x[,2],"line","black","thin","solid")
d1 = createdisplay(2,1)
show(d1,1,1,s1)
show(d1,2,1,s2)
setgopt(d1,1,1, "xlabel", "Time [years]", "ylabel", "Interest rate [%]")
setgopt(d1,2,1, "xlabel", "Time [years]", "ylabel", "Volatility")

Result:
A display containing sample trajectories of the spot price
and volatility processes in the Heston model.



Author: R. Weron, 20040521 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006