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,
dnis used as the underlying source of Poisson process increments, overriding theptypeandlamparameters.- 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_sourceclass 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.statsdistribution 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 meanaand standard deviationb.y=uniform_rv(a, b)- uniform distribution betweenaandb.y=exp_rv(a)- exponential distribution with scalea.y=double_exp_rv(a, b, pa)- double exponential distribution, with scaleawith probabilitypa, and-bwith probability1 - pa.
where
a, b, paare 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 timetto timet + dt, with shape(t + dt).shape + vshape + (paths,). The increments are independent compound Poisson variates, consisting of the sum ofNindependentyory(t + dt/2)variates, whereNis a Poisson variate with meanlam*dt, orlam(t + dt/2)*dt(approximates each variate being taken fromyat the time of the corresponding Poisson process event).
Notes
Preset distributions
norm_rv, uniform_rv, exp_rv, double_exp_rvbehave as follows:- If all parameters are array-like, return an object with an
rvsmethod as described above, and with methodsmean, std, var, exp_meanwith signature(), returning the mean, standard deviation, variance and mean of the exponential of the random variate. - If any parameter is callable, returns a callable
ysuch 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
yrandom variates.
Methods
__call__(t, dt)See cpoisson_source class documentation.