Jump-diffusion timeseries generator¶
-
jumpdiff.jd_process.
jd_process
(time: float, delta_t: float, a: callable, b: callable, xi: float, lamb: float, init: float = None, solver: str = 'Euler', b_prime: callable = None) → numpy.ndarray¶ Integrates a jump-diffusion process with drift a(x), diffusion b(x), jump amplitude xi (\(\xi\)), and jump rate lamb (\(\lambda\)).
\[\mathrm{d} X(t) = a(x,t)\;\mathrm{d} t + b(x,t)\;\mathrm{d} W(t) + \xi\;\mathrm{d} J(t),\]with \(J\) Poisson with jump rate \(\lambda\). This integrator has both an Euler─Maruyama and a Milstein method of integration. For Milstein one has to introduce the derivative of the diffusion term
b
, denotedb_prime
.Parameters: - time (float > 0) – Total integration time. Positive float or int.
- delta_t (float > 0) – Time sampling, the smaller the better.
- a (callable) –
The drift function. Can be a function of a
lambda
. For an Ornstein─Uhlenbeck process with drift-2x
, a takes the forma = lambda x: -2x
. - b (callable) –
The diffusion function. Can be a function of a
lambda
. For an Ornstein─Uhlenbeck process with diffusion1
, a takes the formb = lambda x: 1
. - xi (float > 0) – Variance of the jump amplitude, which will be turned into a normal
distribution like \(\mathcal{N}\)
(0,√xi)
. - lamb (float > 0) – Jump rate of the Poissonian jumps. This is implemented as the numpy
function
np.random.poisson(lam = lamb * delta_t)
. - init (float (defaul
None
)) – Initial conditions. IfNone
given, generates a random value from a normal distribution ~ \(\mathcal{N}\)(0,√delta_t)
. - solver ('Euler' or 'Milstein' (defaul 'Euler')) – The regular Euler─Maruyama solver ‘Euler’ is the default, with an order
of
√delta_t
. To employ a state-dependent diffusion, i.e., b(x) as a function of x, the Milstein scheme has an order ofdelta_t
. You must introduce as well the derivative of b(x), i.e., b’(x), as the argumentb_prime
.
Returns: X – Timeseries of size
int(time/delta_t)
Return type: np.array