Transition probabilities for continuous-time birth-and-death processes.
Parameters:
z0 (array_like) – States of birth-and-death process at time 0.
zt (array_like) – States of birth-and-death process at time(s) t.
t (array_like) – Elapsed time(s) (if has size greater than 1, then must be increasing).
param (array_like) – The parameters governing the evolution of the birth-and-death
process.
Array of real elements of size (n,), where ‘n’ is the number of
parameters.
These must be in the order given here).
model (string, optional) –
Model specifying birth and death rates of process (see here). Should be one of:
’Verhulst’ (default)
’Ricker’
’Beverton-Holt’
’Hassell’
’MS-S’
’Moran’
’pure-birth’
’pure-death’
’Poisson’
’linear’
’linear-migration’
’MS-S’
’M/M/inf’
’loss-system’
’custom’
If set to ‘custom’, then arguments b_rate and d_rate must also be
specified. See here for more information.
method (string, optional) –
Transition probability approximation method. Should be one of
(alphabetical ordering):
options (dict, optional) – A dictionary of method specific options.
Returns:
transition_probability – An array of transition probabilities. If t has size bigger than 1,
then the first coordinate corresponds to t, the second coordinate
corresponds to z0 and the third coordinate corresponds to zt;
for example if z0=[1,3,5,10], zt=[5,8] and t=[1,2,3], then
transition_probability[2,0,1] corresponds to
P(Z(3)=8 | Z(0)=1).
If t has size 1 the first coordinate corresponds to z0 and the second
coordinate corresponds to zt.
Return type:
ndarray
Examples
Approximate transition probability for a Verhulst model using various methods:
Methods for computing transition probabilities and models are also
described in [1]. If you use this function for published work, then please
cite this paper.
For a text book treatment on the theory of birth-and-death processes
see [2].
The parameters associated with this method (listed below) can be
accessed using kwargs in birdepy.probability(). See documentation
of birdepy.probability() for the main arguments.
Parameters:
k (int, optional) – 2**k+1 equally spaced samples between observation times are used
to compute integrals.
Examples
Approximate transition probability for a Verhulst model using diffusion approximation:
The parameters associated with this method (listed below) can be
accessed using kwargs in birdepy.probability(). See documentation
of birdepy.probability() for the main arguments.
Parameters:
z_trunc (array_like, optional) – Truncation thresholds, i.e., minimum and maximum states of process
considered. Array of real elements of size (2,) by default
z_trunc=[z_min,z_max] where z_min=max(0,min(z0,zt)-100)
and z_max=max(z0,zt)+100
k (int, optional) – Number of terms to include in approximation to probability.
Examples
Approximate transition probability for a Verhulst model using Erlangization:
The parameters associated with this method (listed below) can be
accessed using kwargs in birdepy.probability(). See documentation
of birdepy.probability() for the main arguments.
Parameters:
z_trunc (array_like, optional) – Truncation thresholds, i.e., minimum and maximum states of process
considered. Array of real elements of size (2,) by default
z_trunc=[z_min,z_max] where z_min=max(0,min(z0,zt)-100)
and z_max=max(z0,zt)+100
Examples
Approximate transition probability for a Verhulst model using a matrix exponential:
The parameters associated with this method (listed below) can be
accessed using kwargs in birdepy.probability(). See documentation
of birdepy.probability() for the main arguments.
Parameters:
anchor (string, optional) – Determines which state z is used to determine the linear approximation.
Should be one of: ‘initial’ (z0 is used), ‘midpoint’ (default, 0.5*(z0+zt) is used),
‘terminal’ (zt is used), ‘max’ (max(z0, zt) is used), or ‘min’ (min(z0, zt) is used).
Examples
Approximate transition probability for a Verhulst model using a linear approximation:
The parameters associated with this method (listed below) can be
accessed using kwargs in birdepy.probability(). See documentation
of birdepy.probability() for the main arguments.
Parameters:
anchor (string, optional) – Determines which state z is used to determine the linear approximation.
Should be one of: ‘initial’ (z0 is used), ‘midpoint’ (default, 0.5*(z0+zt) is used),
‘terminal’ (zt is used), ‘max’ (max(z0, zt) is used), or ‘min’ (min(z0, zt) is used).
Examples
Approximate transition probability for a Verhulst model using the saddlepoint approximation
to a linear approximation:
The parameters associated with this method (listed below) can be
accessed using kwargs in birdepy.probability(). See documentation
of birdepy.probability() for the main arguments.
Parameters:
lentz_eps (scalar, optional) – Termination threshold for Lentz algorithm computation of Laplace
domain functions.
laplace_method (string, optional) – Numerical inverse Laplace transform algorithm to use. Should be one of:
‘cme-talbot’ (default), ‘cme’, ‘euler’, ‘gaver’, ‘talbot’, ‘stehfest’,
‘dehoog’, ‘cme-mp’ or ‘gwr’.
precision (int, optional) – Numerical precision (only used for methods that invoke mpmath).
k (int, optional) – Maximum number of terms used for Laplace transform numerical inversion.
Only applicable if argument ‘laplace_method’ is set to ‘cme-talbot’,
‘cme’, ‘euler’, ‘gaver’ or ‘cme-mp’.
See https://www.inverselaplace.org/ for more information.
Examples
Approximate transition probability for a Verhulst model using numerical inverse Laplace transform:
The parameters associated with this method (listed below) can be
accessed using kwargs in birdepy.probability(). See documentation
of birdepy.probability() for the main arguments.
Parameters:
k (int, optional) – Number of samples used to generate each probability estimate.
The total number of samples used will be z0.size * k.
seed (int, Generator, optional) – If seed is not specified the random numbers are generated according
to np.random.default_rng(). If seed is an int, random numbers are
generated according to np.random.default_rng(seed). If seed is a
Generator, then that object is used. See
here for more information.
sim_method (string, optional) –
Simulation algorithm used to generate samples (see
here). Should be one of:
The parameters associated with this method (listed below) can be
accessed using kwargs in birdepy.probability(). See documentation
of birdepy.probability() for the main arguments.
Parameters:
z_trunc (array_like, optional) – Truncation thresholds, i.e., minimum and maximum states of process
considered. Array of real elements of size (2,) by default
z_trunc=[z_min,z_max] where z_min=max(0,min(z0,zt)-100)
and z_max=max(z0,zt)+100.
k (int, optional) – Number of terms to include in approximation to probability.
Examples
Approximate transition probability for a Verhulst model using uniformization: