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: simgOU simHeston

Quantlet: simGBM
Description: Simulation of discrete observations of a Geometric Brownian Motion (GBM) via direct integration (method=1) or Euler scheme (method=2). The process follows the stochastic differential equation: dX(t) = mu X(t) dt + sigma X(t) dW(t).

Usage: x = simGBM(n,x0,mu,sigma,delta,method)
Input:
n scalar, time. The number of observations is represented by (ceil(n/delta)+1)
x0 scalar, starting value of the process
mu scalar, drift
sigma scalar, volatility
delta scalar, time step size. The process is simulated at time points 0, delta, 2*delta, ..., n*delta
method scalar, optional, method=1 (default) - direct integration method=2 - Euler scheme
Output:
x (n+1) x 1 vector, simulated trajectory

Example:
library("times")
library("plot")
randomize(102)
time =(0:100)
x = simGBM(1,0.84,0.02,sqrt(0.1),1/100)
pp=setmask(time~x,"line","blue")
plot(pp)
setgopt(plotdisplay,1,1,"xlabel","time t","ylabel","X(t)")

Result:
A display containing a typical trajectory of a GBM is shown.



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