# [R-SIG-Finance] How to code Geometric Brownian Motion Process with Jumps

stefano iacus stefano.iacus at unimi.it
Mon Apr 6 23:13:21 CEST 2009

```If it is diffusion + jumps, than Thomas's code looks not appropriate
at first glance (apologizes to Thomas in advance if I'm wrong). That
code does indeed correctly simulate an OU driven only by levy jumps,
i.e. pure jump process + drift.

One approach is the following: simulate, between times t and, say, t
+dt, the number k of jumps (for example via Poisson in (0,lambda*dt)).
Then simulate the k random increments of the levy part (using you
favorite law: gamma, whatever) and sum them into J

i.e.

k = rpois(1, lambda*dt)
J <- sum(rWHATEVER(k)) # according to levy density of your choice

and finally do something like (assuming mu, sigma are the parameters
of the GBM process)

X[t+dt] = X[t] + mu*X[t]*dt + sigma*X[t]*rnorm(1)*sqrt(dt) + J

this is VERY imprecise, but just to give you an idea, and of course,
as Thomas says, if you specify better the model  you want to simulate,
you may find some ad hoc solutions. There are many flavors of Levy's
(compound, infinite activity, stable, etc)

Also, if dt is not very small, simulation of GBM by Euler scheme is
So take dt <- 1/100000 and then resample the trajectory X at, say
1/100 or so

stefano

On 06/apr/09, at 09:19, Thomas Steiner wrote:

> Hi John-Paul,
> on http://commons.wikimedia.org/wiki/Image:Gamma-OU.png you find a
> Ornstein-Uhlenbeck process which is driven by a Levy process (Gamma
> process). It should be easy to adapt the code for GBM.
> This is a very simplistic approach (Euler approximation), for a
> special process there should be more sophisticated (faster, more
> accurate) methods.
> Let me know if you need help.
> Thomas
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.

```