2.3.4. sdepy.cpoisson_source¶
-
class
sdepy.
cpoisson_source
(*, paths=1, vshape=(), dtype=None, dn=None, ptype=<class 'int'>, lam=1.0, y=None)[source]¶ dj, a source of compound Poisson process increments (jumps).
Parameters: - paths : int
Number of paths (last dimension) of the source realizations.
- vshape : tuple of int
Shape of source values.
- dtype : data-type
Data type of source values. Defaults to
None
.- dn : source or source class, optional
If given,
dn
is used as the underlying source of Poisson process increments, overriding theptype
andlam
parameters.- ptype : data-type
Data type of Poisson process increments. Defaults to
int
.- lam : array-like, or callable
Intensity of the underlying Poisson process, possibly time-dependent. See
poisson_source
class documentation.- y : distribution, or callable, or None
Distribution of random variates to be compounded with the Poisson process increments, possibly time-dependent. May be any
scipy.stats
distribution instance, or any object exposing anrvs(shape)
method to generate independent random variates of the given shape, or a callable withy(t)
evaluating to such object. The following preset distributions may be specified, possibly with time-varying parameters:y=norm_rv(a, b)
- normal distribution with meana
and standard deviationb
.y=uniform_rv(a, b)
- uniform distribution betweena
andb
.y=exp_rv(a)
- exponential distribution with scalea
.y=double_exp_rv(a, b, pa)
- double exponential distribution, with scalea
with probabilitypa
, and-b
with probability1 - pa
.
where
a, b, pa
are array-like with values in the appropriate domains, broadcastable to a shapevshape + (paths,)
, or callables witha(t), b(t), pa(t)
evaluating to such arrays. IfNone
, defaults touniform_rv(a=0, b=1)
.
Returns: - array
Once instantiated as
dj
,dj(t, dt)
returns a random realization of compound Poisson process increments from timet
to timet + dt
, with shape(t + dt).shape + vshape + (paths,)
. The increments are independent compound Poisson variates, consisting of the sum ofN
independenty
ory(t + dt/2)
variates, whereN
is a Poisson variate with meanlam*dt
, orlam(t + dt/2)*dt
(approximates each variate being taken fromy
at the time of the corresponding Poisson process event).
Notes
Preset distributions
norm_rv, uniform_rv, exp_rv, double_exp_rv
behave as follows:- If all parameters are array-like, return an object with an
rvs
method as described above, and with methodsmean, std, var, exp_mean
with signature()
, returning the mean, standard deviation, variance and mean of the exponential of the random variate. - If any parameter is callable, returns a callable
y
such thaty(t)
evaluates to the corresponding distribution with parameter values at timet
.
To compound the Poisson process increments with a function
f(z)
, or time-dependent functionf(t, z)
, of a given random variatez
, one can passy=rvmap(f, z)
tocompound_poisson
.[ToDo: make a note on martingale correction using exp_mean]
Attributes: - y : distribution, or callable
Stores the distribution used computing the Poisson process increments.
- dn_value : array of int
After each realization, this attribute stores the underlying Poisson process increments.
- y_value : list of array
After each realization, this attribute stores the underlying
y
random variates.
Methods
__call__
(t, dt)See cpoisson_source class documentation.